Edited at

Git2.0での変更点をざっと見ていく

More than 5 years have passed since last update.

5/28にGit2.0がリリースされました。

1.9からの変更点をここでまとめておきます。

※最後のほうが雑ですが、ご了承くださいm(_ _)m

リリースノートはこちら


"git push"のデフォルトは"simple"モードに


The "simple" mode is the default for "git push".


"simple"モードとは、「カレントブランチと同名のリモートブランチが存在して、追跡関係にある場合のみpushが行われる」モードです。


simple - like upstream, but refuses to push if the upstream branch's name is different from the local one. This is the safest option and is well-suited for beginners. It will become the default in Git 2.0.


"simple"モードは、最も安全でビギナーに向いているぜって言ってます。

pushのモードについてはこちらの記事がとても親切です。

gitのpush.defaultに関するノウハウ


サブディレクトリ内でも"git add -u/-A <パス指定なし>"は、ソースツリー内のすべてのファイルが対象になる


When "git add -u" and "git add -A" are run inside a subdirectory

without specifying which paths to add on the command line, they

operate on the entire tree for consistency with "git commit -a" and

other commands (these commands used to operate only on the current

subdirectory). Say "git add -u ." or "git add -A ." if you want to

limit the operation to the current directory.


これは、"git commit -a"などの他のコマンドの挙動と合わせるためだそうです。

カレントディレクトリ以下のファイルのみを対象としたい場合は、「git add -u .」や「git add -A .」といった感じにパスを明示しろと言っています。


"git add " と "git add -A "は同じに


"git add is the same as "git add -A " now.


理由は


"git add " used to ignore removals.


と言ってます。

ファイルを削除したときに、git add でindexに追加できるようになりました。


pull.ffを設定することで、git pullがfast-fowradのみを実行可能に


"git pull" can be told to only accept fast-forward by setting the

new "pull.ff" configuration.



"git reset"が、ーNを覚えた


"git reset" learned "-N" option, which does not reset the index

fully for paths the index knows about but the tree-ish the command

resets to does not (these paths are kept as intend-to-add entries)



"git diff-files"の-qは廃止に


The "-q" option to "git diff-files", which does NOT mean

"quiet", has been removed (it told Git to ignore deletion, which

you can do with "git diff-files --diff-filter=d").



core.statinfo設定はcore.checkstatの劣化版なので廃止に


"core.statinfo" configuration variable, which is a

never-advertised synonym to "core.checkstat", has been removed.



GPG署名関連

その1


Many commands that creates commits, e.g. "pull", "rebase",

learned to take the --gpg-sign option on the command line.


その2


"git commit" can be told to always GPG sign the resulting commit

by setting "commit.gpgsign" configuration variable to true (the

command line option --no-gpg-sign should override it).



"git submodule update"を行った際に、detached HEADになってしなうのを改善


Newly cloned submodule repositories by "git submodule update",

when the "checkout" update mode is used, will be on a local

branch instead of on a detached HEAD, just like submodules added

with "git submodule add".



内部のパフォーマンス改善


Performance, Internal Implementation, etc.


  • The bitmap-index feature from JGit has been ported, which should

    significantly improve performance when serving objects form a

    repository that uses it.


  • The way "git log --cc" shows a combined diff against multiple

    parents have been optimized.


  • The prefixcmp() and suffixcmp() functions are gone. Use

    starts_with() and ends_with(), and also consider if skip_prefix()

    suits your needs better when using the former.