Decided to list some useful git commands because i tend to forget them and google them again and again..


git config --global "yourname"
git config --global "your email address"

Repository initilization:

git init

See project status:

git status

Tracking Files:

To add all file and folders

git add .

To add specific file or folder

git add filename
git add foldername

Commit Files:

git commit

Ignoring Files:

create .gitignore file:

vim .gitignore 

(will open the empty .gitignore file in vim)

add your files to the .gitignore.

to save: press esc and :w

to quit: press :q

Check current branch:

git branch

Branching / create new branch:

git branch branchname

Change / switch branch:

git checkout branchname

To view the commit log:

to view in terminal:

git log 


 git log --all 


 log --all --graph --oneline

to view in GUI:



gitk --all

Merging a branch:

git merge branchname 

Create Tag:

lightweight tag:

git tag tagname

(ex. git tag v1.01)

annotated tag:

git tag -a tagname 

(ex. git tag -a v1.01)

Show tag:

git show tagname


git describe

gives something like : tagname-number of commits since the tag-g(first seven SHA1 chars of last commit )

Changing the URI/URL of Remote Git repositoru

git remote set-url origin git://