Re: [PATCH] git push --track
From: Matthieu Moy <hidden>
Date: 2016-06-15 22:48:01
Junio C Hamano [off-list ref] writes:
The small nit is that "branch -f --track me origin/me" will happily overwrite "me", even when your "me" is not up to date with "origin/me", losing commits.
And another issue is: $ git branch -f --track my-branch origin/my-branch fatal: Cannot force update the current branch. $ git branch --track my-branch origin/my-branch fatal: A branch named 'my-branch' already exists. Actually, I just can't find a natural set of commands doing: 1. create a branch (git checkout -b) 2. work on it 3. send it upstream (git push) 4. set the upstream as tracking (???) with the current version of Git. I just do 4. with $EDITOR .git/config ...
Perhaps we could teach "branch --track me origin/me" (i.e. no "-f") not to barf even when "me" exists, as long as "me" is a subset of "origin/me", and treat it as a request to re-configure the upstream information for the existing branch "me" and at the same time fast-forward it to "origin/me"?
+1, and in addition, allow doing this on the checkout branch if it doesn't actually change the reference (i.e. touch .git/config, not .git/refs/...). -- Matthieu Moy http://www-verimag.imag.fr/~moy/