master
브랜치 - no changes to commit
에 대한 작업을 시작한다고 가정 해 보겠습니다. 일부 로컬 변경 작업을 수행하지만이 수정 사항은 master
대신 branch
으로 분리되어야 함을 알고 있습니다.새 분기를 만들고 거기에있는 기존 코드를 이동하는 방법
이동에이 branch
새로운 분리 상태 no changes to commit
에 master
분기를 재 작성 변경 방법 방법이 있나요? 단계를 수행 할 때
편집
git branching - how to make current master a branch and then revert master back to previous version?에 대한 허용 대답에 따라이 ..., 나의 주인은 여전히 최근 코멘트 7 files.See 수정 한 것입니다.
누락 된 것이 있습니까? 당신은 아무것도 커밋하지 않은 경우
$ git branch # 1. starting on master
# On branch master
nothing to commit, working directory clean
# On branch master # 2.modifying a file
# 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: test.txt
#
no changes added to commit (use "git add" and/or "git commit -a")
$ git stash # 3. stashing changes
Saved working directory and index state WIP on master: 393bfad initial commit
HEAD is now at 393bfad initial commit
$ git status
# On branch master
nothing to commit, working directory clean
$ git checkout -b experiment # 4. creating new branch experiment
Switched to a new branch 'experiment'
$ git stash pop # 5. pop staged changes in exper.
# On branch experiment
# 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: test.txt
#
no changes added to commit (use "git add" and/or "git commit -a")
Dropped refs/[email protected]{0} (16b6871d43f367edd03f59558eca4163cd1a2b2f)
$ git checkout master #6. going back to master
M test.txt
Switched to branch 'master'
git status
# On branch 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: test.txt #7. in master test.txt is still modified !!!
가능한 중복 (http://stackoverflow.com/questions/6764893/git-branching-how-to -make-current-master-a-branch-and-then-revert-master-back) –