git-up
git-up copied to clipboard
Please explain how git solves the current problem?
Please update README with a section explaining how recent git versions solved this problem
Basically, since Git 2.0, git push
with no arguments only pushes the current branch (specifically: the default value for push.default
changed from matching
to simple
). This means it doesn't matter if your other branches are out of date.
I've clarified the paragraph a bit.
Thank you.
I believe it would also be valuable to explain how pull changed from merge to rebase ?
I don't believe it did.
ok, well in that case your software right still be useful. in my use case git pull
does rebase for me, compared to say 4 years ago when I was heavy user of git up
that did pull, stash, rebase for me, which is why I needed this tool in the first place..
Here's a one-liner that'll get you a git up
that fetches, stashes, rebases and unstashes on just the current branch:
git config --global alias.up '!git fetch && git rebase --autostash FETCH_HEAD'
I've added it to the README.
@aanand is there an option to use the git alias above to update all local branches with the remote?
This is, for me, the most useful feature in git-up, so, since the gem isn't going to be maintained anymore, I'm searching for a workaround...
Thanks in advance for the great job done so far!
@mauricioklein I don't have a good solution for that, I'm afraid. The only reason I considered it necessary in the first place was because of the default git push
behaviour at the time. Now that that's changed, it doesn't seem that a lot of people need to update all local branches.
I understand. Alright, thanks for the quick explanation. Cheers o/
The alias works for me only on master. If I'm on some other branch it starts to rebase from some other branch, e.g.:
I'm on branch that is 1 day or 10 commits ahead of master.
Master has one new commit.
The branch's remote and my local copy are up to date.
I issue git up
Git fetches all branchen.
Git starts to rebase my branch on top of some the branch that comes alphabetically first.
In my case it started rebasing on a stale branch called addresses
from January.
The alias does not really to what it's supposed to 😕
@despairblue Does this work?
$ git config --global alias.up '!git fetch && git rebase --autostash $(git for-each-ref --format "%(upstream:short)" $(git symbolic-ref -q HEAD))'
@aanand that does work! Thanks 🙇
Thanks @aanand for the great project when it was needed, and the alias updates now.
PSA: as of Git 2.9, you can just do this:
git config --global alias.up 'pull --rebase --autostash'
I'm doing !git pull --rebase --autostash && git log --decorate @{1}..HEAD --pretty=format:'%C(yellow)%h %Cred[%an] %Creset%s'
in the "up" alias to emulate the git-up.rebase.log-hook
. Do you see any problems with doing it this way or know of a better approach?
EDIT: Ah I just realized if I did "up" twice in a row, it would show me the same log twice instead of just once (the first time)
but actually the git alias doesn't resolve the same problem, right?
it does not @Kikobeats . It only updates your current branch. You can try the python port which is still maintained.