🖥

How to force pull with Git ($ git reset --hard origin / branch_name)

2019/04/16に公開

$ git push -f exists. $ git pull -f does not exist.

Instead, you can do the following:

$ git fetch $ git reset --hard origin/branch_name

Alias registration

It may be convenient to keep it.

(Because you can easily rewrite the state of the hand, please note)

Pattern to register with $ git force-pull

~/.gitconfig

 [alias] current-branch-name = ! git branch | grep -e '^\\* ' | sed -e 's/^\\* //g' force-pull = !git fetch && git reset --hard origin/$(git current-branch) 

Original by

Git で force pull する方法 ( $ git reset --hard origin/branch_name )

About

About this translattion

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

https://line.me/ti/g2/eEPltQ6Tzh3pYAZV8JXKZqc7PJ6L0rpm573dcQ

Twitter

https://twitter.com/YumaInaura

公開日時

2019-04-16

Discussion