Ovid/git-workflow

Why not use just `git pull --rebase` instead of `git-refresh`?

Closed this issue · 5 comments

If you configure your rebase command to use autostash:

[rebase]
        autoStash = true

Why not use just git pull --rebase instead of git-refresh?

  -r, --rebase[=false|true|merges|preserve|interactive]
       When true, rebase the current branch on top of the upstream branch after
       fetching.

I come here from [Perlweekly] #456

Ovid commented

Great question and one I should have addressed in the docs that I hastily through together :)

It's possible that this might be OK today, but I'm not sure. This tool was written years ago and and autostash, I believe, wasn't available until git 2.6.0 near the end of 2015. I wanted to ensure that the git tools worked for older versions of git.

And git-refresh always refreshes the current branch on top of master instead of rebasing on the upstream branch.

If that answers your question, let me know and I'll close this ticket.

(Also, our local versions of git-refresh has more features, such as updating libraries to the latest version our code needs)

Ovid commented

Oops. Closed this by accident!

I've had some trouble getting people to put

[pull]
  rebase = preserve

in their git configs, but with that, git pull is enough.

Obviously git pull --rebase is always good for scripts, which never forget what you taught them.

But see #2, which I'm about to open, for another answer

I wanted to ensure that the git tools worked for older versions of git.

back compat. OK.

@Altreus Instead of config file change you can use command line option --autostash:

git pull --rebase --autostash

More details are here