1

I'm using using Git-Stash for a project and trying to always rebase before merging a feature branch to develop branch, in order to keep develop clean, but occasionally I forgot to rebase, is there any way, locally or remotely, that I can prevent this?

A simple logic in my mind is that, if there's any other commits in between the commits on my feature branch, then it needs rebase, but not sure where to go from here.

Heuristic
  • 5,087
  • 9
  • 54
  • 94

2 Answers2

1

git config ff.merge only. Add --system or --global according to the need.

The config disables any true merge. It allows fast-forward merge or rebase only.

ElpieKay
  • 27,194
  • 6
  • 32
  • 53
  • Thanks, I guess this has to be done on Git-Stash, I'm not system admin so I'm looking for a way to prevent it locally, but anyway I've picked your answer. Thanks! – Heuristic Feb 13 '17 at 00:20
0

Try and see if a simple pull through Git-Stash would comply would with following configuration, provided you are using Git 2.9 or more (June 2016)

git config pull.rebase true
git config rebase.autoStash true

That way, only a git pull is needed. Your work in progress would be automatically stashed, and then restored. The pull would do a fetch+rebase.

See "Can “git pull” automatically stash and pop pending changes?"

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250