Back

Git Update Branch While On Other Branch

#git
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’re working in, but you don’t need to switch.

Update Branch

shell
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!

After reading this post, I hope you learned something new or are inspired to create something new! 🤗

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 😁

Suggestions

A Simple Git Workflow: Releaseflow

I’ve seen a lot of organizations use the Gitflow strategy to use Git. It’s not a bad strategy, but it could be way simpler. That’s why I was happy to find Releaseflow. In this post, I want to tell you how it works, and why it could be a benefit for your organization.

#git