On 15/12/2017 17:33, Junio C Hamano wrote:
>
> $ git fetch <remote> <branch>
> $ git checkout -m -B <master> FETCH_HEAD
... aaand that`s how you do it[1] without a temporary branch :)
Junio, what about consecutive runs, while merge conflicts are still
unresolved?
Seeing Josef having a pretty relaxed flow, and his cron job running
every 15 minutes, would adding something like:
$ git add -u
$ git reset
... to the mix, to "silence" actually still unresolved merge
conflicts, making next script execution possible, make sense?
Yes, `git diff` won`t be the same as if conflicts were still in, but
it might be worth it in this specific case, conflicting parts still
easily visible between conflict markers.
Regards, Buga
[1] On 15/12/2017 19:24, Igor Djordjevic wrote:
>
> git checkout -b temp && #1
> git fetch && #2
> git branch -f master origin/master && #3
> git checkout -m master && #4
> git add -u && #5
> git reset && #6
> git branch -d temp #7
>
> Explanation:
> 1. Create temporary branch where we are, switching to it, so we can
> update "master" without local modifications
> 2. Fetch latest updates
> 3. Update "master" to fetched "origin/master"
> 4. Switch to updated "master", merging local modifications
> 5. Mark any pending merge conflicts as resolved by staging them...
> 6. ... and unstage them right away
> 7. Delete temporary branch
>
> Step (4) is what merges your local modifications with remote updates
> (leaving conflicts, if any), where steps (5) and (6) are not needed
> for a single run, but in case you don`t resolve conflicts before next
> cron job executes this script again, step (1) will now fail without
> them because of (still) unresolved merge conflicts.
>
> So, as you seem to be pretty at ease with your flow, you might prefer
> leaving those two steps (5, 6) in.