简体   繁体   中英

Git pull --rebase when push

I'd like to know if it would be possible with git to auto pull --rebase when doing git push ?

I mean if git push is rejected, automatically do a git pull --rebase and then git push again so I don't need to do that manually each time someone push before me.

Thanks for your answers.

You might want to do

git pull --rebase && git push

Maybe you want to create an alias for this

git config --global alias.rbpush '! git pull --rebase && git push'

and then invoke it using:

git rbpush

But keep in mind that the rebase might cause conflits that you have to solve. And while you are solving the conflicts another developer might push in the meanwhile.

[EDIT] Remove "_" in alias's name because git doesn't parse them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM