LoginSignup
0
0

More than 3 years have passed since last update.

Git 基本コマンド

Posted at

新しいレポジトリ作成

git init
git add [filename]
git commit -m "first commit"
git remote add origin [git@github.com:username/filename.git]
git push origin HEAD

branchの作成からpushまで

git branch -a #今いるブランチを確認 (-a:リモートブランチも含めたすべて)
git branch [branchname]
git checkout [branchname]
git add [filename]
git commit -m "comment"
git push origin [branchname]

addのオプション

git add . 
git add *.py
git add -n #追加されるファイルを調べる
git add -u #変更されたファイルを追加する

コミットコメントの書き方

  • fix:バグ修正
  • add:新規機能追加
  • update:機能修正
  • remove:削除

    • Fix wrong markdown
    • Add function
    • Remove some dead code

ファイル、ディレクトリの削除

git rm [filename]
git rm -r [dirname]
git add [filename]
git commit -m "Remove filename"
git push origin HEAD
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