Say I have these git branches:
master
branchone
I want to do this, keeping all history intact:
master -> oldmaster
branchone -> master
You can use the git switch - command to undo any changes you make and return to your previous branch. If you instead want to keep your changes and continue from here, you can use git switch -c <new-branch-name> to create a new branch from this point.
Merge the changes from origin/master into your local master branch. This brings your master branch in sync with the remote repository, without losing your local changes. If your local branch didn't have any unique commits, Git will instead perform a "fast-forward".
You can use git branch -m
.
git branch -m master tmpbranch
git branch -m branchone master
git branch -m tmpbranch branchone
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With