5と6のリビジョン間の差分
2013-10-08 19:04:44時点のリビジョン5
サイズ: 1510
編集者: ilsnsaln
コメント:
2013-10-08 20:08:26時点のリビジョン6
サイズ: 1711
編集者: ilsnsaln
コメント:
削除された箇所はこのように表示されます。 追加された箇所はこのように表示されます。
行 49: 行 49:
* branchを切り替えたい

        git checkout <branch name>

* branchを結合したい

        git checkout <結合先 branch name>
        git merge <取り込まれる branch name>

最初だけやること

git clone <gitレポジトリのURI>  *repositoryに中身がが存在しない場合はmkdir
cd <working directory>
git init
git remote add origin <gitレポジトリのURI>

開発中

git add <file>
git add <file>
...
git commit -m "commit message"
    commitごとにmessageがつくので「1commit1機能」を心がけるとわかりやすい

git add <file>
...
git commit -m "commit message"

...

git push origin
    commitがたまってきたらpush

こんな時は?

  • 変更されたファイルの一覧を確かめたい

    git status
    
  • commit履歴を見たい

    git log
    
  • 前回のcommitをやり直したい

    git commit -m "commit message" --amend
    
  • 前回のcommitを消し去りたい

    logで前々回のcommit名を調べる
    git reset --soft <前々回のcommit name>
    
  • branchを切りたい

    git checkout -b <branch name>
    
  • branchを切り替えたい

    git checkout <branch name>
    
  • branchを結合したい

    git checkout <結合先 branch name>
    git merge <取り込まれる branch name>
    
  • serverから他の人がpushした内容を受け取りたい

    git pull origin
    *conflictしたときの解消法はググって
    
  • branchの派生元を変更したい

    git rebase <new src branch name>
    
  • 特定のファイルの内容を前回のcommit時のものに戻したい

    git checkout HEAD <filename>
    
  • 前回のcommitからの変更点を確認したい

    git diff
    

開発×git (最終更新日時 2013-10-12 00:28:11 更新者 ilsnsaln)