Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update 'git log' after 'git svn fetch' on a bare repo?

Tags:

git-svn

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?

like image 786
vjangus Avatar asked Sep 15 '09 03:09

vjangus


3 Answers

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.

like image 184
Jens Timmerman Avatar answered Oct 22 '22 03:10

Jens Timmerman


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

like image 26
Cebjyre Avatar answered Oct 22 '22 02:10

Cebjyre


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

like image 44
vjangus Avatar answered Oct 22 '22 02:10

vjangus