How to update 'git log' after 'git svn fetch' on a bare repo?
-
07-07-2019 - |
Question
I have a bare git-svn repository and did a 'git svn fetch' on it.
Running 'git log' doesn't show the updates. I'm sure there are updates as it displayed the files changed after 'git svn fetch' and 'git svn log' shows them also.
Please note that I purposely made this a bare repo so 'git rebase' will not work. What is the appropriate command to get the fetched changes?
Solution
Try git log git-svn
- I don't have a bare repo, but I've just run git svn fetch
, and standard git log
gives me the current (rebased) log, but with the git-svn arg (which is the other branch besides master that is identified by git branch -a
in my case) I get the log up to the fetched revision
OTHER TIPS
A git svn fetch
adds a new remote branch called remotes/git-svn (as can be seen with git branch -a
).
If you make changes to the upstream svn, then run git fetch
again, the changes get pulled (actually, fetched) in on this branch, not on master.
So to make git log (and everything else) work ok on the master branch you just need a merge, as you normally would have to do after a fetch (this is what git pull does, a fetch and then a merge).
Since git svn pull does not work, you will have to merge it manually. While on the master branch, run:
git merge remotes/git-svn
This will merge your master branch with the git-svn branch, making everything ok again.
So in the future, run
git svn fetch
git merge remotes/git-svn
and you will be up to date with the upstream repository once again.
Setting the ref of master's head to git-svn head as suggested by vjangus will also make this work, but you shouldn't ever be making changes in a remote branch.
I found the answer,
git symbolic-ref refs/heads/master refs/remotes/git-svn
Thanks to Steven Walter's comments in http://gsocblog.jsharpe.net/archives/12