Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please explain how git solves the current problem? #118

Open
maximveksler opened this issue Apr 1, 2016 · 16 comments
Open

Please explain how git solves the current problem? #118

maximveksler opened this issue Apr 1, 2016 · 16 comments

Comments

@maximveksler
Copy link

Please update README with a section explaining how recent git versions solved this problem

@aanand
Copy link
Owner

aanand commented Apr 1, 2016

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.

@maximveksler
Copy link
Author

Thank you.

I believe it would also be valuable to explain how pull changed from merge to rebase ?

@aanand
Copy link
Owner

aanand commented Apr 1, 2016

I don't believe it did.

@maximveksler
Copy link
Author

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..

@aanand
Copy link
Owner

aanand commented Apr 29, 2016

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.

@mauricioklein
Copy link

mauricioklein commented May 6, 2016

@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!

@aanand
Copy link
Owner

aanand commented May 6, 2016

@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.

@mauricioklein
Copy link

I understand.
Alright, thanks for the quick explanation.
Cheers o/

@despairblue
Copy link

despairblue commented May 26, 2016

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 😕

@aanand
Copy link
Owner

aanand commented May 27, 2016

@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))'

@despairblue
Copy link

@aanand that does work! Thanks 🙇

@harlantwood
Copy link

Thanks @aanand for the great project when it was needed, and the alias updates now.

@aanand
Copy link
Owner

aanand commented Jul 21, 2016

PSA: as of Git 2.9, you can just do this:

git config --global alias.up 'pull --rebase --autostash'

@steven-lai
Copy link

steven-lai commented Aug 23, 2016

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)

@Kikobeats
Copy link

but actually the git alias doesn't resolve the same problem, right?

@jonaswouters
Copy link

it does not @Kikobeats . It only updates your current branch. You can try the python port which is still maintained.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants