Version Control with Git ch3 Getting Started
ch3 Getting Started
git --version
git version 2.17.1
- 超導入なので知らなかったもののみ
git help --all
- 全サブコマンドが出てくる
git help --all
- 多杉
usage: git [--version] [--help] [-C <path>] [-c <name>=<value>] [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path] [-p | --paginate | --no-pager] [--no-replace-objects] [--bare] [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>] <command> [<args>] available git commands in '/usr/lib/git-core' add merge-ours add--interactive merge-recursive am merge-resolve annotate merge-subtree apply merge-tree archive mergetool bisect mktag bisect--helper mktree blame mv branch name-rev bundle notes cat-file pack-objects check-attr pack-redundant check-ignore pack-refs check-mailmap patch-id check-ref-format prune checkout prune-packed checkout-index pull cherry push cherry-pick quiltimport clean read-tree clone rebase column rebase--helper commit receive-pack commit-tree reflog config remote count-objects remote-ext credential remote-fd credential-cache remote-ftp credential-cache--daemon remote-ftps credential-store remote-http daemon remote-https describe remote-testsvn diff repack diff-files replace diff-index request-pull diff-tree rerere difftool reset difftool--helper rev-list fast-export rev-parse fast-import revert fetch rm fetch-pack send-pack filter-branch sh-i18n--envsubst fmt-merge-msg shell for-each-ref shortlog format-patch show fsck show-branch fsck-objects show-index gc show-ref get-tar-commit-id stage grep stash hash-object status help stripspace http-backend submodule http-fetch submodule--helper http-push subtree imap-send symbolic-ref index-pack tag init unpack-file init-db unpack-objects instaweb update-index interpret-trailers update-ref log update-server-info ls-files upload-archive ls-remote upload-pack ls-tree var mailinfo verify-commit mailsplit verify-pack merge verify-tag merge-base web--browse merge-file whatchanged merge-index worktree merge-octopus write-tree merge-one-file 'git help -a' and 'git help -g' list available subcommands and some concept guides. See 'git help <command>' or 'git help <concept>' to read about a specific subcommand or concept.
git commit <ファイル名>
- すでに
git add
済で.gitで追跡済ならば、以降は直接git commit <ファイル名>
でcommitできるgit add
不要
git show-branch
- 全ブランチの歴史を1行ずつ表示
git show-branch
* [master] test ! [tmp] test ! [tmp2] test ! [tmp3] test ---- *+++ [master] test
- 追加でいくつ遡るか指定
git show-branch --more=10
- タスク管理リポジトリに対して実行した結果
- クソみたいな歴史で草
* [master] test ! [tmp] test ! [tmp2] test ! [tmp3] test ---- *+++ [master] test *+++ [master^] tasks done *+++ [master~2] タグ付け *+++ [master~3] タグ付け *+++ [master~4] new tasks *+++ [master~5] aposd ch14 done *+++ [master~6] aposd ch10 done *+++ [master~7] tasks done *+++ [master~8] tasks done *+++ [master~9] read aposd *+++ [master~10] tasks done
設定ファイル
優先度降順
.git/config
git config --file=<configファイルのパス>
に対応- 設定時デフォルト
~/.gitconfig
git config --global
に対応
/etc/gitconfig
git config --system
に対応/usr/local/etc/gitconfig
だったりする- ないこともある
git config -l
,git config --list
で設定読み出し- システムワイドの設定ファイルはなかった
git config -l --system
fatal: unable to read config file '/etc/gitconfig': No such file or directory
- ユーザのやつ
git config -l --global
user.email=xxxxxxxx@yyyy.com user.name=Xxxx Yyyy
- リポジトリ固有のやつ
git config -l --file=.git/config
core.repositoryformatversion=0 core.filemode=true core.bare=false core.logallrefupdates=true remote.origin.url=git@github.com:wand2016/org.git remote.origin.fetch=+refs/heads/*:refs/remotes/origin/* branch.master.remote=origin branch.master.merge=refs/heads/master branch.master.pushremote=origin
- 読み出し時デフォルトは全部優先度順に反映されたもの
git config -l
user.email=xxxxxxxx@yyyy.com user.name=Xxxx Yyyy core.repositoryformatversion=0 core.filemode=true core.bare=false core.logallrefupdates=true remote.origin.url=git@github.com:wand2016/org.git remote.origin.fetch=+refs/heads/*:refs/remotes/origin/* branch.master.remote=origin branch.master.merge=refs/heads/master branch.master.pushremote=origin
- FSの違い等もconfigで吸収
英語
- parlance
- 用語