Menu
blog.headdesk.me
blog.headdesk.me

git rebase branch with head on master

Posted on 2024/11/292024/12/06

In this post, let’s see how to rebase a branch with head on master.

Time0: Brand new git repo with 1 commit on master

Time1: Create a dev branch and add a change

Time2: Switch to master and add a change

If I check the graph of the dev branch, I see that it is branched off the initial commit. If someone switch to the dev branch now, change1 on master will not be available.

Time3: Rebase my dev branch against head on master

❯ git switch dev
❯ git rebase master

Now dev branch is spun off from head on master!

If you want to rebase your local branch with the remote master, the process is similar.

❯git switch change/some-changes
❯git rebase origin/master
❯git push origin change/some-changes --force

Loading

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Full text search

Recent Posts

  • Generate secure password
  • AWS Compute Savings Plans
  • AWS Zonal Shift
  • Coffee break…
  • Prevent private key from being committed to git
  • aws (14)
  • coffee (2)
  • headfi (1)
  • linux (9)
  • others (61)
  • security (2)
  • tech (41)
  • terraform (3)
  • wordpress (2)

Loading

apache aws awscli azure backup boot cloud coffee docker ec2 EL8 ElasticBeanstalk espresso featured git kernel lelit linux lvm meltdown MFA nat gateway php power proliant python rdp Redhat RHEL rpm Ryzen scp security smartarray smart switch snapshot spectre tech terraform ubuntu ubuntu upgrade vpn windows wordpress workspace

©2026 blog.headdesk.me | Powered by SuperbThemes