msiemens / PyGitUp

A nicer `git pull`

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does not work with local only branches

martin-ueding opened this issue · comments

I have a situation where I have a master branch, and several feature branches forked off each other. git-up just quits with a:

Can't update your repo because it doesn't has any remotes.

I would expect it to rebase/merge all my local branches against master.

While I understand your request, PyGitUp is designed to be a replacement for git pull and in the case you described, git pull would complaining that there are no remotes.

No, I can use git pull on a repo that has no remotes at all. It merges with the branch that it trackes, and that works just fine. Therefore, I think that PyGitUp poses an artificial limitation here.

Hmm.. I tried creating a setup, where git pull merges local branches, git pull complained about missing remotes. Could you describe in detail, how you created your setup?

This is my .git/config in that repo:

[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[branch "content/contributions"]
        remote = .
        merge = refs/heads/master
[branch "content/lagrange/sliding-pendulum"]
        remote = .
        merge = refs/heads/master

I create feature branches with git checkout -b BRANCH -t and then I can use git pull to merge the tracking target into that branch.

Thanks, I'll look into that.
Just out of curiosity: I've never seen such a setup before nor can I find anything about it on the internet. Why did you prefer setting the remote to the same repo instead of using plain old git merge?

Well, if I am on a feature branch and do a git merge, it does not default to the upstream branch, although I could change the config to be as such:

mu:~/Projekte/eigene-webseite (content/lagrange/sliding-pendulum<>) LC_ALL=C git merge
fatal: No commit specified and merge.defaultToUpstream not set.

With git pull, it defaults to the upstream branch, without any config setting. And if the upstream branch happens to be remote, it will be fetched automatically. For local branches, it does not make a difference, you are right there:

mu:~/Projekte/eigene-webseite (content/lagrange/sliding-pendulum<>) LC_ALL=C git pull
From .
 * branch            master     -> FETCH_HEAD
...
 126 files changed, 2114 insertions(+), 873 deletions(-)
...

That's a really interesting way to deal with that.
I've added some changes to make PyGitUp work with your setup and by the way fixed possible problems, where the local branch has been renamed (see aanand/git-up#52). I'll propably release it tomorrow (German time 😉)

Fixed in v1.1.0, you can update it via pip install -U git-up :)