Last active
December 11, 2015 12:29
-
-
Save tadasuke/4601309 to your computer and use it in GitHub Desktop.
git関連
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
【直前のコミットのメッセージを変更】 | |
git commit --amend -m "メッセージ" | |
【共有リポジトリに存在しないブランチが"git br -a"で表示される場合の対処法】 | |
git fetch --prune | |
【共有リポジトリで削除したブランチをローカルリポジトリからも削除】 | |
git remote prune origin | |
【git ブランチ名変更】 | |
git branch -m <旧ブランチ名> <新ブランチ名> | |
【リモートリポジトリをローカルにチェックアウト】 | |
git checkout -b localbranch origin/remotebranch | |
【リモートブランチの情報を確認】 | |
git remote -v | |
【git commit の取り消し】 | |
直前のコミットを取り消す場合は | |
git reset --soft HEAD^ | |
--headにすると、ファイル自体も修正されてしまうらしい。 | |
1つ前のコミットでよければHEAD^ | |
2つ前であればHEAD^^ | |
上記を実施するとgit add をされた状態になるので、 | |
git reset HEAD hoge.txt | |
などをして、addも取り消す | |
【リモートのブランチを削除】 | |
git push origin :hogehoge | |
【リモートブランチの情報を更新】 | |
git fetch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment