At work I use Git as a client to SVN, using git svn
. Also I push my Git repository to a remote.
The SVN repository is used by a team of people in my office, while the Git remote repository is used only by me at the moment. This is all part of the process of moving from SVN to Git.
My workflow consist of committing my changes to my local Git repo, then updating my working copy from the SVN changes by other people, committing to SVN, and finally pushing to the Git remote. Something like this:
$ git commit
$ git svn rebase
$ git svn dcommit
$ git push origin
This has worked without issues.
But today, by mistake, I swapped those two last steps around, so I pushed to origin, and then I did git svn dcommit
.
This has caused the origin/master
to diverge from master
, but more importantly to diverge from the git-svn
remote. Now a git log
looks like this:
$ git log --oneline --decorate --graph --all -5
* 613ffa60 (HEAD -> master, git-svn) Fix typo on message displayed to user
| * db2e67ef (origin/master) Fix typo on message displayed to user
|/
* 24d8fab9 Commit C
* c0c1b598 Commit B
* e31c07c0 Commit A
For simplicity I have modified the commit messages above, but note that the two last divergent commits in master
and origin/master
actually contain the same change.
How can I fix this?
I have tried various things like git rebase origin/master
, or git reset --hard origin/master
, but all I get with that is master
and origin/master
to point at the same commit. Like this:
$ git log --oneline --decorate --graph --all -5
* 613ffa60 (git-svn) Fix typo on message displayed to user
| * db2e67ef (HEAD -> master, origin/master) Fix typo on message displayed to user
|/
* 24d8fab9 Commit C
* c0c1b598 Commit B
* e31c07c0 Commit A
Those would be solutions if you are not using git-svn
, but how do I get git-svn
to also point at the same commit? Will I need an extra commit where everything is merged?
As I said before, currently I am the only user of the Git remote, so I won't mind re-writing history in the remote if necessary.