Git - merge 취소하기

Git 2016. 12. 21. 11:29

병합(merge) 시에 충돌(conflict) 등의 문제로 병합이 제대로 이루어지지 않을 경우,

병합 이전의 상태로 돌아간다


git merge 취소하기

git merge --abort


'Git' 카테고리의 다른 글

Git - branch 목록보기, branch 변경하기  (0) 2016.12.19
Git - 변경파일 내역 임시 제외하기  (0) 2016.11.11
Git - add, commit, push 취소하기  (0) 2016.11.11
Posted by G4.
,

Local에 있는 branch 목록보기

git branch -l


Remote에 있는 branch 목록보기

git branch -r


Local, Remote에 있는 모든 branch 목록보기

git branch -a


branch 변경하기

git checkout <branch>


예시

git checkout test

Switched to branch 'test'


$ git checkout master

Switched to branch 'master'

Your branch is up-to-date with 'origin/master'.


'Git' 카테고리의 다른 글

Git - merge 취소하기  (0) 2016.12.21
Git - 변경파일 내역 임시 제외하기  (0) 2016.11.11
Git - add, commit, push 취소하기  (0) 2016.11.11
Posted by G4.
,

.gitignore 파일에 지정해서 변경파일 내역에서 제외하지만 임시로 제외할 수 있는 방법도 있다.


변경파일 임시 제외

git update-index --assume-unchanged 파일명


변경파일 임시 제외 취소

git update-index --no-assume-unchanged 파일명


변경파일 임시 제외 모두취소

git update-index --really-refresh


예시

$ git status

On branch master

Your branch is up-to-date with 'origin/master'.

Changes not staged for commit:

  (use "git add <file>..." to update what will be committed)

  (use "git checkout -- <file>..." to discard changes in working directory)


modified:   .gitignore

modified:   README.md


no changes added to commit (use "git add" and/or "git commit -a")


$ git update-index --assume-unchanged README.md

$ git status

On branch master

Your branch is up-to-date with 'origin/master'.

Changes not staged for commit:

  (use "git add <file>..." to update what will be committed)

  (use "git checkout -- <file>..." to discard changes in working directory)


modified:   README.md


no changes added to commit (use "git add" and/or "git commit -a")


'Git' 카테고리의 다른 글

Git - merge 취소하기  (0) 2016.12.21
Git - branch 목록보기, branch 변경하기  (0) 2016.12.19
Git - add, commit, push 취소하기  (0) 2016.11.11
Posted by G4.
,
git 되돌리는 방법에 대해 검색해보니 너무 어렵게 나와있고 블로그마다 달라서 직접 사용해보고 적어둔다.
아래 명령어들은 가장 최근 add, commit, push 것들을 취소해준다.

명령어들의 개념이나 각종 옵션들은 검색해보면 많이 나와있으니 궁금하면 찾아보길 바란다. 


git add 취소하기

git reset


git commit 취소하기

git reset HEAD~1


git push 취소하기

git reset HEAD^

git push origin <branch> -f


'Git' 카테고리의 다른 글

Git - merge 취소하기  (0) 2016.12.21
Git - branch 목록보기, branch 변경하기  (0) 2016.12.19
Git - 변경파일 내역 임시 제외하기  (0) 2016.11.11
Posted by G4.
,