Git Update Branch While On Other Branch

No need to stash your changes anymore!

Dev By RayRay
Β·Apr 2, 2021Β·

2 min read

Git Update Branch While On Other Branch

Subscribe to my newsletter and never miss my upcoming articles

Play this article

I have those moments quite frequently, I need to update my develop branch, but I don't want to switch to it in git.

Well, I discovered a way to fetch another branch you’re working in, but you don’t need to switch.

git fetch origin develop:develop

With this command, you can continue to work in your feature branch and update the develop or master branch. No need to stash your current changes because you need to switch branches anymore!

It’s super easy and valuable to me. I thought It might be helpful to you as well πŸ‘


Git 101

If you want to grow your Git skills on the terminal, then check out these posts (with videos πŸ“Ή):

  1. Setup Git, create repo local and remote repository
  2. Add, stage, commit & push
  3. Branches
  4. Merging branches, merge conflicts & cherry-pick

Thanks!

hashnode-footer.png I hope you learned something new or are inspired to create something new after reading this story! πŸ€— If so, consider subscribing via email (scroll to the top of this page) or follow me here on Hashnode.

Did you know that you can create a Developer blog like this one, yourself? It's entirely for free. πŸ‘πŸ’°πŸŽ‰πŸ₯³πŸ”₯

If I left you with questions or something to say as a response, scroll down and type me a message. Please send me a DM on Twitter @DevByRayRay when you want to keep it private. My DM's are always open 😁

Did you find this article valuable?

Support Dev By RayRay by becoming a sponsor. Any amount is appreciated!

See recent sponsors |Β Learn more about Hashnode Sponsors
Β 
Share this

Impressum

I learn by writing, and write while learning more and more each day!πŸ‘Š A developer is never finished with learning, thinking that is the most stupid thing to do 🀣