You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Installation and configuration:
Installing git on redhat based system
$ sudo yum install git
Installing git on debian based system
$ sudo apt-get install git
To configure the Editor
$ git config --global core.editor "/usr/bin/vim"
Cloning Repository
To Clone the repository on local
$ git clone <repository_URL>
Git Branching
To check all the remote branch
$ git branch -a
To check the current branch
$ git branch
To create branch
$ git branch <branch_name>
To switch branch
$ git checkout <branch_name>
To create and switch to the branch
$ git checkout -b <branch_name>
To rename the branch
$ git branch -m <branch_name>
Git add/commit/push/merge
To add all file to the repository
$ git add .
To commit the changes
$ git commit -m <commit_message>
To push the changes to the branch
$ git push origin <branch_name>
To merge
$ git merge <branch_name>
To remove the file/directory from repository
$ git rm <file/dir_ name>
Git Ignore
Globally Ignore:
To create Ignore file for globally
$ git config –global <file_name> <path>
Example: git config --global core.excludesfile '/etc/gitignore'
Locally Ignore:
To create Ignore file
$ vim .gitignore
Example: *.dll - To ignore the .dll Files.
tmp/* - To ignore tmp directory and files in it.
Git changes Tracking
To check the commit history
$ cat .git/refs/heads/<branch_name>
To know which file has been tracked
$ git status -s
Example: A License ( A for added and <file_name>), AM License (A for added and M for modified <file_name)
To check file changes in detail
$ git status -v
To check the commit history in detail
$ git log
To check to commit history in one line
$ git log –oneline
To check the last 10commits
$ git log -10
To check In graph view
$ git log –graph
Git Tag
To check the Tag
$ git tag
To create the Tag
$ git tag -a <tag_name/version no> -m <message>
To check the tag commit details
$ git show <version no/tag_name>
To delete the Tag
$ git tag -d <tag_name>
Git Difference
To check the latest commit difference
$ git diff
To check the difference between two commits
$ git diff <commit_ID1> <commit_ID2>
To check commit difference summary
$ git diff –summary <commit_ID1> <commit_ID2>
Git Garbage Collection
To check, if the repository needs to clean
$ git gc --auto
To remove old objects (Older than two weeks)
$ git gc –prune
To configure gc should clean garbage every 30 days
$ git config gc.pruneexpire "30 days"
Yogesh Mude
Rising StarHornbillWorldWide
Hyderabad, India
151 accepted answers
0 comments