bash - What are the implications of switching to git config push.default current? -


i have bash function prevent error when pushing remote repository (eg. github) without upstream branch. familiar error:

$ git checkout -b test $ git push fatal: current branch test has no upstream branch. push current branch , set remote upstream, use      git push --set-upstream origin test 

to fix that, intercept calls git push , see if i'm getting error related no upstream branch. in case of error, instead of copy , paste suggested command above, terminal it's going execute automatically me.

this code if curious: https://github.com/arturoherrero/dotfiles/blob/6f517a0b7287ac61174dfd2b6c9ee5bf9a9c2e96/system/git.sh#l22-l34


my current git configuration push.default simple, today i've realised i can use push.default current achieve same behaviour (removing custom code).

ref. https://www.kernel.org/pub/software/scm/git/docs/git-config.html

  • current - push current branch update branch same name on receiving end. works in both central , non-central workflows.

  • simple - in centralized workflow, work upstream added safety refuse push if upstream branch’s name different local one.

    when pushing remote different remote pull from, work current. safest option , suited beginners.

    this mode has become default in git 2.0.

so, implications of switching git config push.default current? i'd understand possible scenarios have problems because git has different behaviour.

the implications when push repo, git assume branch names correspond. if ever push single remote (origin) , use same name same branch in remote , local, fine. if want set other types of branch mapping - example, if local feature branch feature_1 should go remote branch dev/features/feature_1 or - not want use simple push.default.

there's aren't hidden implications; documentation posted explains behavior, , if it's behavior want can use it.


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -