Day 11: 90DaysOfChallenge

Day 11: 90DaysOfChallenge

Advance Git & GitHub for DevOps Engineers: P-2

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 CommandsDescription
git stashStash the file
git stash listShows the list of stashed files
git stash popBring back the stashed file
git stash dropDelete a stash
git stash clearDeletes 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-

CommandsDescription
git statusShows the files that have conflicts
git diffShows the difference between the conflicting versions
git addAdd the resolved files(for staging)

Thanks!

~Shilpi