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 git.github.io.
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.
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
after or before the above commands to avoid failures in case the
script runs many times and there are conflicts.
rebaseboth as an alternative to
mergeand as a history rewriting tool.
Git tools and sites
git bisectthat allows running tests on multiple hosts in order to bisect faster”.
git bisect runthat uses multiple concurrent tests to try to finish a bisect more quickly”, with an explanatory blog post.
This edition of Git Rev News was curated by Christian Couder <email@example.com>, Jakub Narębski <firstname.lastname@example.org>, Markus Jansen <email@example.com> and Gabriel Alcaras <firstname.lastname@example.org>.