update git.md

This commit is contained in:
Chandra Mohan Jha 2019-12-31 16:29:02 +05:30
parent 06ba0e9e09
commit c2014afdfa
1 changed files with 20 additions and 1 deletions

19
git.md
View File

@ -1,14 +1,33 @@
# Git # Git
` git init ` Initialize git ` git init ` Initialize git
` git status ` Get status ` git status ` Get status
` git add <file-name> ` add file to version control ` git add <file-name> ` add file to version control
` git add . ` add all files to version control ` git add . ` add all files to version control
` git commit [-m "commit message"] ` commit the changes to version control ` git commit [-m "commit message"] ` commit the changes to version control
` git log ` get the log related to git i.e. version committed ` git log ` get the log related to git i.e. version committed
` git reflog ` lists all the log
` git branch ` get the branches present locally ` git branch ` get the branches present locally
` git checkout <file-name> ` checkout/reset the file
` git checkout <branch-name> ` checkout the branch ` git checkout <branch-name> ` checkout the branch
` git checkout -b <branch-name> ` create a new branch and check it out ` git checkout -b <branch-name> ` create a new branch and check it out
` git merge <source-branch> ` merges the source branch into currently checked out branch ` git merge <source-branch> ` merges the source branch into currently checked out branch
` git remote add origin <repo-uri> ` add remote repo uri ` git remote add origin <repo-uri> ` add remote repo uri
` git remote -v ` lists the remote URIs ` git remote -v ` lists the remote URIs
` git diff ` list all the changes
` git reset [<branch-name>/<commit-hash>] ` reset the current status to given snapshot