Tuesday, June 29, 2021

Basic Git Commands

 git status --s [short] 

git status --long 

git status     [same as git status --long]

git status --u [untracked files]


git add xx.txt  [adds a file to git, it starts getting tracked, but not commited]

git commit -m "add file xx.txt"  [-m provides custom message given by user to tag the commit]


git add . [add all the files to staging are - both modified and new]



git checkout xx.txt [overwrites xx.txt in working area with last staged version in staging area]


get reset HEAD xx.txt [overwrites xx.txt in staging area from commited area- last commited version]


list all branches : 

git branch -a


git pull = git fetch + git merge FETCH_HEAD


Checkout a particular version of a file: 

git log filename.ext

git checkout XXXX filename.ext   [XXXX-> first four digit of commit hash key]



useful git cheatsheet: 

http://ndpsoftware.com/git-cheatsheet.html#loc=remote_repo;


https://marklodato.github.io/visual-git-guide/index-en.html

http://git-scm.com/book/en/v2/Git-Basics-Undoing-Things


No comments:

Post a Comment

 using Microsoft.AspNetCore.Mvc; using System.Xml.Linq; using System.Xml.XPath; //<table class="common-table medium js-table js-stre...