Day 11 Task: Advance Git & GitHub for DevOps Engineers: Part-2

Git Stash:
If you need to temporarily save changes, Git stash is a helpful command that you can use without committing them. This is especially useful when you want to switch to a different branch to work on something else. To use Git stash, you create a new branch and make changes to it. Then, you can use the command 'git stash' to save those changes. This will remove the changes from your working directory and record them in a new stash.
Later, you can apply these changes. You can view the list of stashed changes using the 'git stash list' command. You may also use 'git stash drop' to delete a stash and 'git stash clear' to delete all stashes.
Cherry-pick:
Git cherry-pick is a useful command that allows you to pick specific commits from one branch and apply them to another. This can come in handy when you want to selectively apply changes made in one branch to another.
To use git cherry-pick, you first need to create two new branches and make some commits to them. Then, use the 'git cherry-pick <commit_hash>' command to select the specific commits from one branch and apply them to the other.
Resolving Conflicts:
Conflicts can arise when you merge or rebase branches that have taken different paths. In such a case, you must resolve the conflicts manually before proceeding with the merge/rebase process. You can use the git status command to identify files with conflicts, the git diff command to compare the conflicting versions, and the git add command to add the resolved files.
Happy Learning!!



