summaryrefslogtreecommitdiff
path: root/transport.h
diff options
context:
space:
mode:
authorChristopher Tiwald <christiwald@gmail.com>2012-03-20 00:31:33 -0400
committerJunio C Hamano <gitster@pobox.com>2012-03-19 21:42:06 -0700
commitf25950f3475e263ed6c8f0797bb058ba6444f85e (patch)
tree93090d1d543b82c68166593a04a50f0478172b11 /transport.h
parent0e2d57fd50f61e668be3180bc8f25991ea88aa8c (diff)
downloadgit-f25950f3475e263ed6c8f0797bb058ba6444f85e.tar.gz
push: Provide situational hints for non-fast-forward errors
Pushing a non-fast-forward update to a remote repository will result in an error, but the hint text doesn't provide the correct resolution in every case. Give better resolution advice in three push scenarios: 1) If you push your current branch and it triggers a non-fast-forward error, you should merge remote changes with 'git pull' before pushing again. 2) If you push to a shared repository others push to, and your local tracking branches are not kept up to date, the 'matching refs' default will generate non-fast-forward errors on outdated branches. If this is your workflow, the 'matching refs' default is not for you. Consider setting the 'push.default' configuration variable to 'current' or 'upstream' to ensure only your current branch is pushed. 3) If you explicitly specify a ref that is not your current branch or push matching branches with ':', you will generate a non-fast-forward error if any pushed branch tip is out of date. You should checkout the offending branch and merge remote changes before pushing again. Teach transport.c to recognize these scenarios and configure push.c to hint for them. If 'git push's default behavior changes or we discover more scenarios, extension is easy. Standardize on the advice API and add three new advice variables, 'pushNonFFCurrent', 'pushNonFFDefault', and 'pushNonFFMatching'. Setting any of these to 'false' will disable their affiliated advice. Setting 'pushNonFastForward' to false will disable all three, thus preserving the config option for users who already set it, but guaranteeing new users won't disable push advice accidentally. Based-on-patch-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Christopher Tiwald <christiwald@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'transport.h')
0 files changed, 0 insertions, 0 deletions