Show differences between remote branch and local branch

First, get remote branches up-to-date.

$ git fetch
$ git svn fetch  # only if you have Subversion remote repository using git-svn

Show remote branches.

$ git branch -a
* master
  remotes/origin/master
  remotes/svn/tags/RELEASE_20101022
  remotes/svn/tags/RELEASE_20101025
  remotes/svn/trunk

Show changes between current local branch and remote branch.

$ git diff remotes/origin/master

Show changes between current local branch and remote branch. (simple)

$ git diff --name-status remotes/origin/master

Show changes between current local branch and remote branch. (simple, Subversion repository)

$ git diff --name-status remotes/svn/trunk

Source: git svn status - showing changes that are not committed to svn - Stack Overflow

Redmine error when synchronizing repositories with Git

I executed Repository.fetch_changesets using script/runner by cron to synchronize repositories of Redline with Git and I got an error below.

git: not found

I modified redmine/lib/redmine/scm/adapters/git_adapter.rb like below and it became OK.

#GIT_BIN = "git"
GIT_BIN = "/usr/local/bin/git"
※ On r4795, r4797, you can set scm_git_command to the path to Git in configuration.yml, so you no longer need such modification like above.

I also encountered an onother problem.
When the user who executes Redmine does not have permission for the Git repository directory (like xxx.git), Redmine shows "The entry or revision was not found in the repository." error on repository page.

Workaround is:

$ sudo chmod o+rx xxxx.git
  • If the repository is in a user's home directory (e.g. on gitosis or gitolite), you also have to do chmod o+x for the user's home directory.