Git Quick Reference

Here are some tips for git users

git init
-- Initialize the folder with .git ignore file. Means folder has been included in the local git repo

git add . 
-- This means all the files in the folder should be included in git staging

git status
--As command says status, shows what has been staged-modified-not tracked.

git commit 
--his means commit the files from staging to repo

git commit -m "some message"
--commit with some message

git branch
-- List all branches

git branch <branchname>
-- create a branch in git

git branch -D <branchname>
-- To delete a branch

git checkout <branchname>
-- This is to create a new branch in git

git checkout -b <branchname>
-- This is to create a new branch and simultaneously take to the newly created branch [*best practice]

git checkout <master>
git merge <from_childbranch>
-- Merge always from parent to child, that's why we checkout master first and pull the changes from child branch.

git pull <remote> <branchname>
-- Behave like get latest from the remote server

git push <remote> <branchname>
-- Pushes the changes to remote repo



Git & GitHub with the game: https://learngitbranching.js.org/

Comments

Popular Posts