Table of contents
Git Stash:
Git Stash is a command which is used to store the ongoing changes into the working directory without actually committing the file. If a user is working on any file and wants to work on some other branch but also do not want the earlier file to be deleted or committed, he can stash the file i.e. temporarily store the file in the stash. Once his work in other branches is done he can bring back the stashed file back into the working directory and start working on it. Stash changes can be reapplied or dropped as needed. Following are some of the stash commands and their definitions-
Git Commands | Description |
git stash | Stash the file |
git stash list | Shows the list of stashed files |
git stash pop | Bring back the stashed file |
git stash drop | Delete a stash |
git stash clear | Deletes all the stashes |
Cherry-pick:
Cherry pick is a command that allows to apply any specific commit to any other branch. This is useful when we want to apply specific commit to any different branch without merging the enitre branch. Command: git cherry-pick <commit-id>.
Resolving Conflicts:
Conflicts occur when we merge/rebase a branch to one another and the same file contains different contents in same line. This conflicts has to be resolved manually in order to merge/rebase the branch successfully with one another. Following are some of the git commands useful for resolving conflicts and their definitions-
Commands | Description |
git status | Shows the files that have conflicts |
git diff | Shows the difference between the conflicting versions |
git add | Add the resolved files(for staging) |
Thanks!
~Shilpi