0
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?

More than 5 years have passed since last update.

Gitコマンド超省略版

Last updated at Posted at 2020-09-14

Linux(Ubuntu)のターミナルからGitを操作する最低限のコマンドをまとめました。

クローン

git clone (URL)

コミット関係

基本これの繰り返し
※ cd で更新するディレクトリに予め移動

git add .
git commit -m 'commit comment'
git push origin master # masterブランチの更新

ブランチを切る

git branch -a # 一覧 
git checkout (ブランチ名) # 移動
git checkout -b feature # 作成+移動(featureは例)
git merge feature # featureをmasterにマージ(masterだけになる)

ここまで使えば個人レベルのgit管理はできそう

(おまけ)あんまり使ってない編

git branch -d feature # ローカルブランチ削除
git branch -d -r origin/feature # 追跡ブランチ削除
git push origin :feature # 空ブランチを指定してリモートブランチ削除

git reset --soft HEAD^ # 直前のコミット取り消し

resetは以下が参考になりそう
https://qiita.com/ChaaaBooo/items/459d5417ff4cf815abce

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?