「Gitでよくやること」の版間の差分

提供: オレッジベース
ナビゲーションに移動 検索に移動
編集の要約なし
編集の要約なし
98行目: 98行目:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
$ git stash list
$ git stash list
</syntaxhighlight>
=== config関連 ===
==== Author ====
<syntaxhighlight lang="bash">
$ git config --global user.name <NAME>
$ git config --global user.email <EMAIL>
</syntaxhighlight>
==== permission変更を無視 ====
<syntaxhighlight lang="bash">
$ git config core.filemode false
</syntaxhighlight>
</syntaxhighlight>



2018年7月11日 (水) 02:49時点における版

リポジトリの作成

$ mkdir <DIR>
$ cd <DIR>
$ git init --bare --shared

clone

$ git clone <REPOSITORY_PATH>

pull

$ git pull

変更の確認

$ git status

add

とりあえず全部

$ git add -A

新規作成 or 変更されたもの

$ git add .

変更があったもののみ

$ git add -u

commit

$ git commit -m "<MESSAGE>"

push

$ git push <REMOTE> <BRANCH_NAME>

merge

$ git merge <BRANCH_NAME>

branch確認

$ git branch

or

$ git branch -a

checkout

切り替え

$ git checkout <BRANCH_NAME>

新しくブランチを持ってくる

$ git checkout -b <BRANCH_NAME> <REMOTE>/<BRANCH_NAME>

e.g

$ git checkout -b develop origen/develop

checkoutできないとき

エラー内容

fatal: git checkout: updating paths is incompatible with switching branches.
Did you intend to checkout 'origin/remote-name' which can not be resolved as commit?

こうする

$ git remote show <REMOTE>
$ git remote update
$ git fetch
$ git checkout -b <BRANCH_NAME> <REMOTE>/<BRANCH_NAME>

stash

とりあえず面倒なとき

$ git stash

メッセージ付きでstash

$ git stash save "<MESSAGE>"

一覧

$ git stash list

config関連

Author

$ git config --global user.name <NAME>
$ git config --global user.email <EMAIL>

permission変更を無視

$ git config core.filemode false