とりあえず、git status
で現在の状態を確認します:
console
1$ git status
2On branch feature
3You have unmerged paths.
4(fix conflicts and run "git commit")
5(use "git merge --abort" to abort the merge)
6
7Unmerged paths:
8(use "git add <file>..." to mark resolution)
9
10both modified: merge.txt
上記のように (fix conflicts and run "git commit")
と表示されていたら、
merge
で発生した競合の解決中の状態です
ひとまず、(use "git merge --abort" to abort the merge)
と表示されている通り
merge
を取り消します:
console
1git merge --abort
これを完全にmasterと同じ状態にするのにはどうすれば良いのでしょうか?
次のコマンドでいつでも完全に master
と同じ状態にできます
console
1git checkout master
ただし、こうすると作業ブランチではなく master
になります
本当に作業ブランチを master
ブランチと一緒にしたければ、
この状態で作業ブランチを削除して新規作成し直します:
git branch -d 作業ブランチ
git checkout -b 作業ブランチ