LoginSignup
29
29

More than 5 years have passed since last update.

Git2.4のアップデート内容について

Last updated at Posted at 2015-05-02

概要

下記の記事を見てGitのバージョン2.4でどのような機能が追加されたのか調べてみました。
Git 2.4 — atomic pushes, push to deploy, and more-
https://github.com/blog/1994-git-2-4-atomic-pushes-push-to-deploy-and-more

Atomic push

※ 2015/05/02 時点ではGithub.comでは未対応のようです

複数のbranchや、branchとtagを一度にpushする場合に、どれかのpushに失敗した時にほかのbranchやtagのpushもしないようにするということだと思います(未検証)。
例えばbranchA, Bにpushしようとした場合

$ git push origin branchA branchB

とした時に、branchAのpushにrejectされてもbranchBのpushは成功してしまいます。

$ git push --atomic origin branchA branchB

--atomicオプションをつけるとbranchAへのpushに失敗した場合にbranchBへのpushも行わないということだと思います。

push-to-checkout hook の追加

push先のリモートリポジトリがbareオプション付きで作成されてない場合、リモートリポジトリのカレントブランチとpushした時のローカルリポジトリのカレントブランチの参照先が同じ場合、pushに失敗してしまいます(core.bareなどを変更すればできます)。
このときにhookして色々操作できるhookだと思います(未検証)。

Inverted grep オプションの追加

--grepオプションでlogをフィルタリングするときに、キーワードにマッチしないというフィルタリングができるようになったみたいです。

test:$ git log --oneline -10
bd62842 aa
367040b Merge branch 'test' of ssh://36.55.237.164:3843/root/test into test
2f96f76 test
bc94303 master2
d8eaabe test1
beff40f master1
28e2863 test
87ac987 modify
9618523 Merge branch 'master' of github.com:totomo/test into test
ce46542 add test.php
test:$ git log --oneline --invert-grep  --grep "Merge" -10
bd62842 aa
2f96f76 test
bc94303 master2
d8eaabe test1
beff40f master1
28e2863 test
87ac987 modify
ce46542 add test.php
35088f4 aaa
6609754 merge hoge

Merge にマッチしないログのみでていることがわかります。

statusにverboseオプションの追加

--verbose, -v を2回指定すると、ローカルリポジトリのHEADとコミットされていない変更点との差分を見ることができる(つまり git diff と git diff --stagedの差分を両方あわせて見ることができる)。

test:$ git status -v -v
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

    modified:   test.txt

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   test.py

Changes to be committed:
diff --git c/test.txt i/test.txt
index 3f27ceb..f18bc09 100644
--- c/test.txt
+++ i/test.txt
@@ -1,4 +1,5 @@
 a
+b
 a
 b
 d
--------------------------------------------------
Changes not staged for commit:
diff --git i/test.py w/test.py
index 10e80c1..f9b3593 100644
--- i/test.py
+++ w/test.py
@@ -1,4 +1,5 @@
 # coding:UTF-8
+
 print "Hello"
 a

log --decorate の表示形式を微修正

# 以前
test:$ git log --decorate
commit 0c8224c974a53262dfb79a9cc5b55622df630cd4 (HEAD, test)
Merge: 56125a2 a36aaf2
Author: Kenta Tokumoto <totomo_1217@yahoo.co.jp>
Date:   Sun May 3 00:39:00 2015 +0900

    Merge branch 'master' into test


# v-2.4.0

test:$ git log --decorate
commit 0c8224c974a53262dfb79a9cc5b55622df630cd4 (HEAD -> test)
Merge: 56125a2 a36aaf2
Author: Kenta Tokumoto <totomo_1217@yahoo.co.jp>
Date:   Sun May 3 00:39:00 2015 +0900

    Merge branch 'master' into test
...

(HEAD, test) が (HEAD -> test) に変わっただけなような気がします。

defaultで--follow-tagsを有効にする

$ git config --global push.followTags true

HTTPでリクエストした時にヘッダにAccept-Languageが追加される

httpでやりとりするときにヘッダに Accept-Languageフィールドが追加されるようになったみたいです。

29
29
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
29
29