LoginSignup
0
0

More than 1 year has passed since last update.

【Git】 うっかりmainブランチでコードを書き進めてしまった。新しいブランチで最初から書き直さないとダメ??

Posted at

コード

$ git stash -u          # 一旦、作業したコードをstash(隠し場所)に移す
$ git checkout ブランチ名 # 本来作業したかったブランチに移動
$ git stash pop         # stashに置いておいたコードを戻す

解説

  • git stash -uで、一旦現在のコードを退避する。
  • git stash popで退避していたコードを新規ブランチに戻す。
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0