LoginSignup
1
3

More than 5 years have passed since last update.

基本的なGit Command

Last updated at Posted at 2017-06-27

内容

基本的なgit commandについて。

gitについて、その特徴

  • プログラムソースなどの変更履歴を管理。
  • ファイルの状態の好きな時に更新履歴として保存しておくことができる。

よく使うgit command

  1. git init
    • リポジトリを作成
  2. git clone
    • 既存リポジトリの複製を作成
  3. git fsck
    • リポジトリの破損箇所を特定
  4. git gc
    • リポジトリ内のオブジェクトの圧縮(pack)や不要なオブジェクトの破棄などを行う
  5. git status
    • 変更が加えられたファイルを表示
  6. git diff
    • ファイルに加えられた変更点をdiff形式で表示
  7. git add .
    • コミットするファイルを指定
  8. git commit
    • 変更点をコミット
  9. git commit -a -m "コミットメッセージ"
    • 変更が加えられたファイルを自動で検出し、""内のコミットメッセージを付け加えてコミット
  10. git log
    • コミットログを閲覧
  11. git reset
    • 直前のコミットを取り消す
  12. git commit --amend
    • 直前のコミットを訂正
  13. git revert <コミット名>
    • 作業ツリーを指定したコミット時点の状態にまで戻し、コミットを行う。引数にはコミットを指定するハッシュ文字列もしくはタグ名などを指定。
  14. git branch <ブランチ名>
    • ブランチ情報の表示、ブランチの作成
  15. git checkout
    • ブランチの切り替え
  16. git show-branch
    • ブランチの作成/変更/マージ履歴を表示
  17. git merge <変更点の取り込み元ブランチ>
    • ローカルブランチのマージ
  18. git stash
    • 現在の作業ツリーの状態を一時的に保管(退避)
  19. git rebase <派生元ブランチ>
    • ブランチの派生元(上流)を変更
  20. git pull
    • 公開リポジトリ(githubなど)に自分のリポジトリの内容を送信

参考

https://mag.osdn.jp/09/03/16/0831212
http://qiita.com/konweb/items/621722f67fdd8f86a017
http://www.backlog.jp/git-guide/

1
3
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
3