Git is a Version Control System designed to handle everything from small to very large projects with speed and efficiency. You should already the basics commands: init, add, commit and push. But I want to introduce you to some basic commands that can help you a lot, so let's go.
git merge
Incorporates changes from the commits of another branch into the current branch.
$ git checkout <branch that will receive changes>
$ git merge <branch with changes>
git rebase
Reapply commits on top of another branch.
$ gut checkout <branch that will receive changes>
$ git rebase <branch with changes>
git stash
Use git stash when you want to record the current state of the working directory and the index, but not commit this modifications.
$ git stash
Can be list the modifications stashes:
$ git stash list
Restored:
$ git stash apply
Apply specific stash:
$ git stash apply stash@{2}
git cherry pick
Apply the changes introduced by some existing commits.
$ git cherry-pick <commit hash>
git commit --amend
Modify the latest commit:
$ git commit --amend
If you commit and forgot to stage the changes in a file you wanted to add to this commit:
$ git commit -m 'Initial commit'
$ git add forgotten_file
$ git commit --amend
Conclusion
Eu hope this article has been helpful for your learning. Look the 'Reference' to learn more about git.
Top comments (0)