Git is a free software and distributed version control system. We can simply maintain and track our project files in git repository. It is a GNU version and slightly similar to other versioning system such as CVS, Subversion or Mercurial.
We can call Git as a 'social network' for programmers or developers, which gives speed and efficiency in development. Different commands are used to handle the operations in git.
Some useful git commands are listed below.
Modify the Previous Commit Message.
git commit --amend
Undo the Previous Commit.
git revert HEAD
Undo a specific Commit.
git revert <commit-id>
It create a new commit that removes all lines added and adds all lines removed in that commit.
Temporarily Stash Changes, Restore the changes later.
After changes have been made...
Do some other stuff here, like switching branches, merge other changes, etc. Again re-apply the changes.
git stash pop
Tagging, Deleting, and Pushing Tags.
Create a Tag
git tag <tagName>
Delete a tag
git tag -d <tagName>
git push --tags
Search specific logs
grep log --grep="your search word"
Merging new branches to the current branch.
git merge <newbranch>
Graphical interface to a local repository.
Delete branch local branch.
git branch -D <branchName>
Delete remote branch.
git push origin --delete <branchName>
Search branch by keyword.
git branch -a | grep <keyword>
Check for difference.
Difference between two branches.
git diff branch_1..branch_2
View changes to a file relative to the index
git diff <path/to/modified/file/name>
If you use git as your version control system in development, this will definitely help you. You may also look into other solved issues related to Git over here.
Please get in touch to know more.