Git Rev News: Edition 35 (January 17th, 2018)

Welcome to the 35th edition of Git Rev News, a digest of all things Git. For our goals, the archives, the way we work, and how to contribute or to subscribe, see the Git Rev News page on

This edition covers what happened during the month of December 2017.



Josef Wolf first described his current workflow which uses Subversion (SVN).

Josef has a number of machines that all have a working copy of the same repository in a specific directory. A cron job updates the working copies and then run scripts contained in the working copies.

When using svn update to update those copies, the changes made locally on the machines are automatically merged with the upstream changes, usually without conflicts.

Then Josef explained what would happen with Git:

With git, by contrast, this won’t work. Git will refuse to pull anything as long as there are ANY local modifications. The cron job would need to

git stash
git pull
git stash pop

But this will temporarily remove my local modifications. If I happen to do a test run at this time, the test run would NOT contain the local modifications which I was about to test.

Randall S. Becker suggested using git fetch instead of git pull to be able to first tell if changes from upstream have to be applied to the local copy, and also using a branch for each machine to better track local changes and merge them with upstream changes.

Josef replied to Randall by asking for a way to “properly check whether a merge is actually needed” as it looks like git status or git diff are not very well suited for that purpose.

Igor Djordjevic, alias Buga, wondered about the possibility, in the original workflow, of running scripts that are being worked on. Buga also said that using git stash would probably have other issues, so he suggested the “(scripted) creation of a temporary branch at fetched remote branch position, and using something like git checkout --merge <temp_branch> to merge … local modifications to latest changes fetched from remote”.

In a later email Buga alternatively suggested “using git worktree add <temp_copy_path> to create a temporary working tree … alongside a temporary branch” and deleting those after having committed, merged and pushed the local changes made there.

Josef replied to Buga that some potential issues Buga worried about are not relevant when using SVN because of the specifics of his work, while others are indeed relevant when using Git.

About the solutions Buga had suggested, Josef and Buga started to discuss them, but at this point Junio Hamano, the Git maintainer, suggested using just:

git fetch <remote> <branch>
git checkout -m -B <master> FETCH_HEAD


<remote> <branch>: the branch at the remote you are pulling from
<master>: whatever branch you are using

After some tests and further discussion, Josef agreed that this was a good solution. Buga also suggested using git add -u and git reset after or before the above commands to avoid failures in case the script runs many times and there are conflicts.


Other News


Light reading

Git tools and sites


This edition of Git Rev News was curated by Christian Couder <>, Jakub Narębski <>, Markus Jansen <> and Gabriel Alcaras <>.