.NET 開発基盤部会 Wiki」は、「Open棟梁Project」,「OSSコンソーシアム .NET開発基盤部会」によって運営されています。

目次

概要

Gitコマンドの覚書

用語

repository

http://www.backlog.jp/git-guide/intro/intro1_2.html

local / remote

http://www.backlog.jp/git-guide/intro/intro1_3.html

bare / non-bare

http://www.nekotricolor.com/entry/theory-of-bare-and-non-bare-repository-manage-wordpress-themes-with-git

branch

http://www.backlog.jp/git-guide/stepup/stepup1_1.html

branch名

HEAD

現在使用しているbranchの先頭を表す名前

stash

ファイルの変更内容を一時的に記録しておく領域。

commit

ファイルやディレクトリの追加・変更を、Repositoryに記録する

編集/ステージ/コミットプロセス

branch

branch

branchする

checkout

branchをcheckoutする(切り替える)。

merge

branchをmergeする。

削除

branchを削除する。

repository

clone

git clone は既存の git repositoryのclone (コピー) を作成する

repository間

git remote

git fetch

remote repositoryからfetchする。

git pull

remote repositoryからpull(fetch & merge)する。

git push

remote repositoryへpushする。

ステージングの操作

git add

ステージング・エリアにaddする。

git clean

ステージング・エリアからcleanする。

git reset

commitのreset

commitの操作

<commit> = commit の"SHA-1 id"

git commit

変更のcommit

git revert

commitのrevert

git reset

commitのreset

確認

branch

git branch

branchの確認

commit

git log

logの確認

ステージング

git status

statusの確認

Rebase、Reset、Revert

Rebase、Reset、Revert の違いと使い分け

Rebase

「履歴を綺麗にしたい」場合に使う(ローカルでのみ行うべき)

概要

動作イメージ

https://www.google.com/search?q=Rebase&udm=2

注意点

Reset

「間違えてコミットした」場合に使う(ローカルでのみ行うべき)

概要

注意点

Revert

「リモートに影響を与えずに変更を取り消したい」(安全なので推奨される)場合に使う

概要

注意点

比較表

コマンド目的履歴の改変影響範囲
rebase履歴を整理・ブランチを最新にするするローカルのみ(要 `push --force`)
resetコミットを取り消す・巻き戻すするローカルのみ(特に `--hard` に注意)
revert特定のコミットを打ち消すしないリモートでも安全

トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS