Linux Basics Linux Commands

Useful GIT Commands

useful git commands

Useful Git Commands

This post gives some useful Git Commands which will help you to play with a git repository.

What is Git?

Git is a program that helps to do version control. It is able to keep track of files. This is how Git providing version control. Git created by Linus Torvalds the one who created the Linux kernel.

Check below for some useful Git Commands:

To create a branch:
git checkout -b <branch_name>
To show all branches:
git branch
To move to the master branch:
git checkout master
To pull updates: (Only Run from Master branch)
git pull
To move to the newly added branch:
git checkout <branch_name>
To get the difference:
git diff
To get the status:
git status
To save the changes:
git commit <file_name> -m "comment"
To commit all changes:
git commit -am "comment"
To push the changes:
git push -u origin <branch_name>

It will give a URL. Give that for merging.

To get the whole log:
git log
To pull all files other than the changed ones:

This needs to be done inside the branch

git rebase master
Then, Push Your Changes:
git push -f
To delete a branch:
git branch -d <branch_name>

That’s it!

Also Read:

If you like the post Understanding top Command and wish to receive more articles from us, please like our FB page: GrepItOut

Your suggestions and feedbacks will encourage us and help to improve further, please feel free to write your comments. For more details on our services, please drop us an E-mail at [email protected]