On Tue, Feb 4, 2020 at 2:03 PM Bill Schmidt <wschm...@linux.ibm.com> wrote:
>
> I'm having a little difficulty with my workflow, and I'm hoping someone
> can spot the problem.
>
> I have a user branch set up with the contrib/git-add-user-branch.sh
> script.  Here are the relevant portions of my .git/config:
>
> [remote "users/wschmidt"]
>          url = git+ssh://wschm...@gcc.gnu.org/git/gcc.git
>          fetch = +refs/users/wschmidt/heads/*:refs/remotes/users/wschmidt/*
>          fetch = +refs/users/wschmidt/tags/*:refs/tags/users/wschmidt/*
>          push = refs/heads/wschmidt/*:refs/users/wschmidt/heads/*
> [branch "wschmidt/builtins"]
>          remote = users/wschmidt
>          merge = refs/users/wschmidt/heads/builtins
>
> I originally created the branch from master.  I then made 15 local
> commits, and pushed these upstream.
>
> I now want to rebase my branch from master, and reflect this state
> upstream.  My recipe is:
>
> git checkout master
> git pull
> git checkout wschmidt/builtins
> git rebase master
> git push --dry-run users/wschmidt +wschmidt/builtins
>
> After the rebase step, git status shows:
>
> On branch wschmidt/builtins
> Your branch and 'users/wschmidt/builtins' have diverged,
> and have 39 and 15 different commits each, respectively.
>    (use "git pull" to merge the remote branch into yours)
>
> nothing to commit, working tree clean
>
> Looks fine to me, so lets try the force push:
>
> wschmidt@marlin:~/newgcc/gcc/config/rs6000$ git push --dry-run
> users/wschmidt +wschmidt/builtins
> To git+ssh://gcc.gnu.org/git/gcc.git
>   * [new branch]              wschmidt/builtins -> wschmidt/builtins
>
> Well, that's odd, why is it trying to create a new branch?
>
> If I inadvisedly attempt to push without --dry-run, I am stopped from
> creating the new branch:
>
> remote: *** Shared development branches should be named devel/*, and
> should be documented in https://gcc.gnu.org/git.html .
> remote: error: hook declined to update refs/heads/wschmidt/builtins
> To git+ssh://gcc.gnu.org/git/gcc.git
>   ! [remote rejected]         wschmidt/builtins -> wschmidt/builtins

You can use "git push -f" or

$ git push origin :yourbranch
$ git push -u origin yourbranch

Since it is hassle to use 2 commands, I use gitlab.com for my own work.

> (hook declined)
> error: failed to push some refs to
> 'git+ssh://wschm...@gcc.gnu.org/git/gcc.git'
>
> It seems wrong that it is trying to update refs/head/wschmidt/builtins
> (thus creating a new branch).  It seems like there may be a missing
> "users/" needed someplace.  But I am not at all confident that's
> correct.  I'm a little suspicious of the push spec in my config.
>
> Can someone with strong git-fu give me any suggestions?
>
> Best regards,
> Bill
>


-- 
H.J.

Reply via email to