NorthIsUp
NorthIsUp

Reputation: 17867

Enforce no merging while staged changes exist in git

I want to enforce (i.e. throw an error and fail) whenever I do a git merge with staged changes. Much in the same why a git rebase will not work if unstaged changes exist. Is there a way to do this?

The goal of this is to enforce a workflow like:

git stash
git pull #or git merge
git pop

Upvotes: 1

Views: 130

Answers (1)

J-16 SDiZ
J-16 SDiZ

Reputation: 26910

Try git config branch.autosetuprebase true and git config branch.<name>.rebase true (where <name> is any existing branch name). This would default pull to use --rebase.

Note: just like any merge/rebase, this may have conflicts. The git config manual page actively warns against this option.

Upvotes: 1

Related Questions