Skip to content

Instantly share code, notes, and snippets.

@marocchino
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marocchino/a00eddc1a19517abb8c2 to your computer and use it in GitHub Desktop.
Save marocchino/a00eddc1a19517abb8c2 to your computer and use it in GitHub Desktop.
리베이스된 리모트 브렌치 가져오기.

뭐 예를 들어, 회사 컴퓨터로 작업하다 force push하고 집에 와서 작업을 이어해야하는 상황에서 그냥 평범(?)하게 pull하면 컨플릭트가 납니다.

이럴 때는 이렇게 하면됩니다.

git fetch --all
git reset --hard origin/som_work

alias도 만듬.

[alias]
  pullf = !git fetch --all && git reset --hard origin/$(git rev-parse --abbrev-ref HEAD)

일단 브랜치이름이 같아야 하고, reset --hard의 현재 브랜치는 다 날려버리니 조심해서 사용하세요.

출처: http://stackoverflow.com/questions/1125968/force-git-to-overwrite-local-files-on-pull

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment