DEV Community

ಮಿಥುನ್
ಮಿಥುನ್

Posted on

git stash usage for beginners

In the below branch tree, let's say you are working on Feature-branch-helper.

  • master
    • develop
      • Feature-branch
        • Feature-branch-helper

Now you completed working on Feature-branch-helper, before you merge with Feature-branch, you would want to take latest from Feature-branch. Without taking latest from Feature-branch you cannot merge. In this case we can use git stash.

Steps I follow to update current branch. Assuming you are in Feature-branch-helper.

First take backup of your changes

 git stash          
Enter fullscreen mode Exit fullscreen mode

Second take latest of Feature-branch

 git pull origin Feature-branch
Enter fullscreen mode Exit fullscreen mode

Resume your changes to your branch ,Feature-branch-helper

 git stash pop
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay