usethis icon indicating copy to clipboard operation
usethis copied to clipboard

Function to document/set merge strategy

Open Aariq opened this issue 4 months ago • 1 comments

I think fairly recently git started requiring that you set one of three merge strategies before pulling when there are divergent branches:

hint: You have divergent branches and need to specify how to reconcile them.
hint: You can do so by running one of the following commands sometime before
hint: your next pull:
hint: 
hint:   git config pull.rebase false  # merge (the default strategy)
hint:   git config pull.rebase true   # rebase
hint:   git config pull.ff only       # fast-forward only
hint: 
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
fatal: Need to specify how to reconcile divergent branches

While these can be set with use_git_config(pull.rebase = "false"), for example, it might be nice to have a dedicated function for this. It could serve as 1) a place to document pros and cons of these choices and maybe suggest a default (I had a lot of trouble deciding which one to choose when I first encountered this message) and 2) provide easier to remember options like strategy = c("merge", "rebase", "fast-forward").

Also git_sitrep() should check if one of these options is set, which I don't think it currently does.

Aariq avatar Feb 29 '24 19:02 Aariq