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 3 years have passed since last update.

GitHubでよく使うコマンドの種類

Last updated at Posted at 2018-12-30

作業環境

Windows10

よく使うコマンド集

  • ファイルまたはディレクトリの削除
    ファイルを削除の場合は$ git rmだが、ディレクトリの削除の場合は$ git rm -rする。
    $ git rm [-r] db
  • コミット履歴
    $ git log
  • addしてるファイルを見るとき
    $ git status
  • コミットまで
    $ git add [ファイル名]
    $ git commit -m "[メッセージ]"
  • commitの取り消し
    $ git reset --soft "HEAD^"
  • addの取り消し
    $ git reset HEAD [ファイル名]

個人作業の場合

  • pushするとき
    $ git push origin master

共同作業の場合

  • pushするとき
    git push -u origin "[ブランチ名]"
  • ブランチの作成
    $ git checkout -b [ブランチ名]
  • 場所の確認
    $ git branch
  • masterのものを手元に持ってくる
    自分の手元で変更したものがある場合は一度git stashで退避してからgit pullする必要がある。
    $ git stash
    $ git pull origin master
    $ git stash apply
    または
    $ git checkout master
    $ git pull
  • コミットするファイルの名前を見る(自分で変更したファイルの一覧)
    $ git diff --name-only
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?