Skip to main content

Git Update Branch While On Other Branch

No need to stash your changes anymore!

Updated 2 min readMarkdown
Part of seriesLearn Git Basics
Git Update Branch While On Other Branch

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鈥檙e working in, but you don鈥檛 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鈥檚 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 馃榿

About the author

  • 馃殌 Tech Lead / Lead Developer 馃敟 Writing about CSS, JavaScript, Typescript, Angular, Vue.js, Nuxt.js, Serverless functions, and a lot more web-related topics. https://byrayray.dev/

No comments yet. Be the first to comment.

Learn Git Basics

Part 1 of 2

In this series we dive into the core basics of Git. I will show you in a very simple way how to work with Git on the terminal.

Up nextA simple Git Workflow: ReleaseflowLet's make our Git workflow simpler!