code

브랜치 생성 이후 커밋 표시

codestyles 2020. 12. 15. 19:19
반응형

브랜치 생성 이후 커밋 표시


git log브랜치 생성 후 추가 된 커밋 만 또는 다른 명령 으로 볼 수있는 방법이 있습니까?

usage: git log [<options>] [<since>..<until>] [[--] <path>...]
   or: git show [options] <object>...

    --quiet               suppress diff output
    --source              show source
    --decorate[=...]      decorate options

세 개의 마침표를 사용하여 두 번째 분기가 첫 번째 분기에서 분기 된 커밋을 참조하거나이 경우 분기가 마스터에서 분기 된 경우를 참조하십시오.

git log master...<your_branch_name>

이 경우 3 개의 마침표 를 사용해야 합니다.

참고 : git이 자동으로 HEAD 포인터를 참조하므로 브랜치 이름을 생략 할 수도 있습니다. 예를 들면 다음과 같습니다.

git log master...

이전 예제와 동일합니다. 이것은 커밋 비교가 가능한 모든 곳에서 작동합니다.


전체 문서는 여기 : https://www.kernel.org/pub/software/scm/git/docs/gitrevisions.html

다음과 같은 저장소가 있다고 가정합니다.

base  -  A  -  B  -  C  -  D   (master)
                \
                 \-  X  -  Y  -  Z   (myBranch)

저장소 상태를 확인하십시오.

> git checkout master
Already on 'master'
> git status ; git log --oneline
On branch master
nothing to commit, working directory clean
d9addce D
110a9ab C
5f3f8db B
0f26e69 A
e764ffa base

myBranch의 경우 :

> git checkout myBranch
> git status ; git log --oneline
On branch myBranch
nothing to commit, working directory clean
3bc0d40 Z
917ac8d Y
3e65f72 X
5f3f8db B
0f26e69 A
e764ffa base

myBranch에 있고 SINCE 마스터 만 변경하려는 경우를 가정 해보십시오. 두 점 버전을 사용하십시오.

> git log --oneline master..myBranch
3bc0d40 Z
917ac8d Y
3e65f72 X

점 3 개 버전은 master의 끝에서 myBranch의 끝까지 모든 변경 사항을 제공합니다. 그러나 공통 커밋 B는 포함되지 않습니다.

> git log --oneline master...myBranch
d9addce D
110a9ab C
3bc0d40 Z
917ac8d Y
3e65f72 X

참고 : git log그리고 git diff다르게 행동 하십시오 ! 동작은 정반대는 아니지만 거의 다음과 같습니다.

> git diff master..myBranch
diff --git a/rev.txt b/rev.txt
index 1784810..e900b1c 100644
--- a/rev.txt
+++ b/rev.txt
@@ -1 +1 @@
-D
+Z

> git diff master...myBranch
diff --git a/rev.txt b/rev.txt
index 223b783..e900b1c 100644
--- a/rev.txt
+++ b/rev.txt
@@ -1 +1 @@
-B
+Z

따라서 두 점 버전은 마스터 팁 (예 : D)에서 myBranch 팁 (Z)까지의 차이를 보여줍니다. 점 3 개 버전은 myBranch의베이스 (예 : B)에서 myBranch의 끝 (Z)까지의 차이를 보여줍니다.


생성 한 브랜치에있는 경우 :

git log master..

예, "새"브랜치를 마스터 브랜치 (일반적으로 "마스터"라고 함)와 비교할 수 있습니다.

git log master..<your_branch_name>

물론 <your_branch_name>.


I could be wrong but I don't think any of the answers are exactly was being asked for in the OP so I wanted to add a new answer. I believe that this is the exact same question I had since in other source control systems this is very easy to do.

I have the following in MASTER:

'develop' | --> 'GP603'

In ORIGIN (my local system) I have:

'GP603' [CLONED from the remote/GP603 branch]

I then performed 2 different commits. First commit change File X. Second commit change File X and File Y. Some day later I wanted to just validate my assumption of the state of the local branch ORIGIN/GP603. This is what I did to validate that there were only he 2 commits I remembers doing (which in reality were the only 2 commits on the branch)

$ git log origin/GP.603...

(Commit 2) commit b0ed4b95a14bb1c4438c8b48a31db7a0e9f5c940 (HEAD -> GP.603) Author: xxxxxxx Date: Wed xxxxx -0400

1. Fixed defect where the format of the file names and paths were being added to HashTable in such a way that they would never be matched in any comparison.  This was an
defect causing older failed files to never be moved to the correct directory (WindowsServiceApplication.cs)

2. Removing worthless and contextless message as it does nothing but clog the log with garbage making it harder to read (DinoutFileHandler.cs)

(Commit 1) commit 2c4541ca73eacd4b2e20d89f018d2e3f70332e7e Author: xxxxxxx Date: Tue Oct xxxxx -0400

In ProcessFile() function need to perform a .ToLower() on the file path string when adding it o the failedFiles collection.

ReferenceURL : https://stackoverflow.com/questions/9725531/show-commits-since-branch-creation

반응형