Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Repoint git-svn master branch back to trunk

Tags:

git-svn

I'm not sure how I got into this state, but my master branch on my local git-svn repo seems to be pointing to the remote UAT branch.

git status
# On branch master nothing to commit (working directory clean)
git svn dcommit Committing to https://svn...com/MyRepo/branches/UAT ...

how do I fix this?

like image 430
Scott Weinstein Avatar asked Feb 13 '12 04:02

Scott Weinstein


1 Answers

I think what you're trying to fix is that your local "master" branch is based on the remote UAC branch, as opposed to the remote trunk. If you're happy to lose your commits, you can simply run the below, which will checkout the trunk and then move the master branch to your current point.

git checkout remotes/trunk
git checkout -B master

If you don't want to lose your commits, git rebase is your friend. Use the below:

git rebase $(git merge-base remotes/UAC master) master --onto remotes/trunk

This works out the common parent of the UAC branch and the local master branch, makes all the commits from there to the tip of the master branch onto the trunk, then moves the master branch to point there.

like image 118
me_and Avatar answered Sep 22 '22 23:09

me_and