1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

職場でよく使うGitコマンドメモ書き

Posted at

ブランチ生成(ブランチを切る)

git checkout <Branch-A>
git pull
git checkout -b <Branch-B> origin/<Branch-A>
git commit --allow-empty -m "first commit"
git push -u origin <Branch-B>

ブランチ削除

# ブランチ切り替えとプル(最新状態を反映)
git checkout <branch-A>
git pull
# ローカルブランチ削除
git branch -d <branch-B>
# リモートブランチ削除
git push origin --delete <branch-B>

直近のコミットに差し込みたい fixup

新たにコミットするまでもないような小さな修正を直前のコミットに組み込むことができます。
プッシュ時に強制プッシュを行います。

# 結合したいコミットのコミットハッシュ
git commit --fixup <commit hash>
# 結合したいコミットの1つ前のコミットハッシュ
git rebase -i --autosquash <commit hash>
# 強制プッシュ
git push -f
1
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?