//한칸뒤로 되돌리기
git reset --hard HEAD~1
//다시 원래상태로 되돌리기 원상복구
git reset --hard ORIG_HEAD
git log --oneline
//2칸뒤로 되돌리기
git reset --hard HEAD~2
//다시 원래상태로 되돌리기 원상복구
git reset --hard ORIG_HEAD
//브렌치 추가
git branch purple
//브렌치 확인
$ git branch
//purple 브렌치로 이동
$ git checkout purple
***** git purple 브렌치만 가져오기 *****
$ git clone https://github.com/braverokmc79/git-practice.git
$ git branch -r
origin/HEAD -> origin/master
origin/master
origin/purple
$ git checkout -t orign/purple
***** git master 브렌츠로 이동 후 purple 브렌치 삭제 *****
$ git checkout master
$ git branch -d purple
//브렌치 확인
$ git branch
*****1) git yellow 브렌츠 생성후 이동 *****
$ git branch yellow
$ git checkout yellow
*****2) git yellow 브렌츠 생성후 이동 *****
git checkout -b yellow
=======연습-충돌(conflict) -로컬 병합(Merge)
//git push 시도시 충돌 오류
/e/study/React/git-practice (master)
$ git push origin master
To https://github.com/braverokmc79/git-practice.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/braverokmc79/git-practice.git'
hint: Updates were rejected because the remote contains work that you do not
hint: have locally. This is usually caused by another repository pushing to
hint: the same ref. If you want to integrate the remote changes, use
hint: 'git pull' before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
/e/study/React/git-practice (master)
// 뒤로 한칸 되돌리기
$ git reset --hard HEAD~1
HEAD is now at d01fa91 4
========================================================>
다음과 같이 pull 시도시 충돌 날경우
$ git pull origin master
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (1/1), done.
remote: Total 3 (delta 1), reused 3 (delta 1), pack-reused 0
Unpacking objects: 100% (3/3), 266 bytes | 4.00 KiB/s, done.
From https://github.com/braverokmc79/git-practice
* branch master -> FETCH_HEAD
d01fa91..9166a1f master -> origin/master
Updating c60c1a6..9166a1f
Fast-forward
index.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
========================================================>
git pull 에러 해결 (Your local changes to the following files would be overwritten by merge ) -git stash
출처: https://goddaehee.tistory.com/253 [갓대희의 작은공간:티스토리]
https://goddaehee.tistory.com/253
댓글 ( 4)
댓글 남기기