ローカルでブランチを使って作業していました。
とりあえずの段階で、一旦pushしようと思いました。

\vim\.vim\bundle\evervim>git push github
Warning: Permanently added 'github.com,192.30.252.130' (RSA) to the list of known hosts.
Counting objects: 27, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (23/23), done.
Writing objects: 100% (25/25), 4.55 KiB | 0 bytes/s, done.
Total 25 (delta 5), reused 0 (delta 0)
To git@github.com:kakkyz81/evervim.git
   40c257f..b4581f3  unite -> master

あ、ローカルのブランチがgithubのmasterに行っちゃった。

\vim\.vim\bundle\evervim>git push github unite
Warning: Permanently added 'github.com,192.30.252.129' (RSA) to the list of known hosts.
Total 0 (delta 0), reused 0 (delta 0)
To git@github.com:kakkyz81/evervim.git
 * [new branch]      unite -> unite

とりあえず、ちゃんとブランチ作ってpush
そのあと復旧作業に。githubのmasterに切り替えます

\vim\.vim\bundle\evervim>git checkout github/master
Note: checking out 'github/master'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

HEAD is now at b4581f3... work - unite list notebook with multi byte string

チェックアウトされました

\vim\.vim\bundle\evervim>git status
# HEAD detached at github/master
# Untracked files:
#   (use "git add ..." to include in what will be committed)
#
#       .gitignore
#       plugin/py/lib/evernotesdk/
nothing added to commit but untracked files present (use "git add" to track)

git rebase -i HEAD~2で、次の画面で直前のコミットを取り消します

\vim\.vim\bundle\evervim>git rebase -i HEAD~2
Successfully rebased and updated detached HEAD.

取り消した結果を反映させます

参考:
http://blog.livedoor.jp/enjoy_baseball-advanced/archives/51544249.html

\vim\.vim\bundle\evervim>git push github +master
Warning: Permanently added 'github.com,192.30.252.129' (RSA) to the list of known hosts.
Total 0 (delta 0), reused 0 (delta 0)
To git@github.com:kakkyz81/evervim.git
 + b4581f3...40c257f master -> master (forced update)
\vim\.vim\bundle\evervim>git status
# HEAD detached at d838f9b
# Untracked files:
#   (use "git add ..." to include in what will be committed)
#
#       .gitignore
#       plugin/py/lib/evernotesdk/
nothing added to commit but untracked files present (use "git add" to track)

間違えないように、作業用のブランチをチェックアウトします。

\vim\.vim\bundle\evervim>git checkout github/unite
Previous HEAD position was d838f9b... Created basic structure for the unite
HEAD is now at b4581f3... work - unite list notebook with multi byte string
Pocket

Comments are closed.