Git의 저자와 커미터의 차이점은 무엇입니까?
나는 커밋하려고합니다.
git commit --author="John Doe <john@doe.com>" -m "<the usual commit message>"
여기서 John Doe는 커밋하려는 이름의 사용자입니다.
에 모두 나타납니다 git log
. 그러나 나는이 작업을 수행 할 때 gitk
, 저자의 이름은 정확하지만, 커미터 이름은 내 글로벌 자식 설정 설정에서 선택됩니다 (따라서 내 이름 / 이메일로 설정).
질문
둘 (커미터와 저자)의 차이점은 무엇입니까?
다른 사용자에게도 커미터를 설정해야합니까?
그렇다면 어떻게?
원본 포스터는 다음과 같이 묻습니다.
이 두 가지 (Committer와 Author)의 차이점은 무엇입니까?
저자는 원래 코드를 작성한 사람입니다. 반면 커미터는 원래 작성자를 대신하여 코드를 커밋 한 사람으로 간주됩니다. Git을 사용하면 히스토리를 다시 쓰거나 다른 사람 대신 패치를 적용 할 수 있으므로 Git에서 중요합니다. 무료 온라인 프로 힘내 책은 이런 식으로 설명 :
저자 와 커미터 의 차이점이 무엇인지 궁금 할 것 입니다. 저자는 반면, 원래 패치를 쓴 사람 커미터가 마지막으로 패치를 적용하는 사람입니다. 따라서 프로젝트에 패치를 보내고 핵심 멤버 중 하나가 패치를 적용하면 작성자와 핵심 멤버가 커미터로 인정됩니다.
원본 포스터는 다음과 같이 묻습니다.
다른 사용자에게도 커미터를 설정해야합니까?
아닙니다. 정직하고 싶다면 저자와 커미터가 같은 사람이 아닌 한 커미터를 저자에게 설정해서는 안됩니다.
메일 링리스트 + git format-patch
+ git apply
는 저자를 생성 할 수 있습니다! = 커미터
패치가있는 Linux 커널과 같은 프로젝트에서 :
- 에 의해 생성 된
git format-patch
- 복사 붙여 넣기 또는보다 일반적으로
git send-email
- 하나와 다른 사람에 의해 적용
git apply
나git am
: 어떻게 이메일 메시지에서 패치를 적용하는 자식 오전를 사용하는?
다른 작성자 및 커미터로 단일 새 커밋 생성
- 저자는 누가 패치를 썼는가
- 커미터는 프로젝트 관리자이며 패치를 병합 한 사람입니다.
예를 들어이 무작위로 선택된 패치와 해당 커밋을 참조하십시오.
- https://lkml.org/lkml/2018/1/25/568
- https://github.com/torvalds/linux/commit/5beda7d54eafece4c974cfa9fbb9f60fb18fd20a
GitHub 및 GitLab과 같은 Git 웹 인터페이스는 작성자! = 커미터를 생성하거나 생성하지 않을 수 있습니다.
Git (Hub | Lab)은 동일한 머신에서 업스트림 및 포크 리포지토리를 모두 보유하므로 다음 중 하나를 포함하여 로컬에서 수행 할 수있는 모든 작업을 자동으로 수행 할 수 있습니다.
병합 커밋을 만듭니다.
author! = committer를 생성하지 않습니다.
SHA 또는 새 커밋을 그대로 유지하고 새 커밋을 만듭니다.
* Merge commit (committer == author == project maintainer) |\ | * Feature commit (committer == author == contributor) |/ * Old master (random committer and author)
역사적으로 이것은 GitHub에서 처음으로 사용 가능한 방법이었습니다.
로컬에서는이 작업을 수행합니다
git merge --no-ff
.풀 요청 당 두 개의 커밋을 생성하고 git 기록에 포크를 유지합니다.
위에 기지를 세우다
master
GitHub는 커밋을 해킹하여 커미터 == 병합 버튼을 누를 사람을 설정합니다. 이것은 필수 사항은 아니며 기본적으로 로컬에서 수행
git rebase
하지는 않지만 프로젝트 관리자에게 책임을 부여합니다.자식 트리는 다음과 같습니다 :
* Feature commit (committer == maintainer, author == contributor) | * Old master (random committer and author)
git apply
이메일 패치 와 정확히 같습니다 .
현재 GitHub에서 :
- 병합 버튼의 드롭 다운을 통해 병합 할 때 방법을 선택합니다
- 소유자가 repo 설정에서 메소드를 사용 또는 사용하지 않도록 설정할 수 있습니다.
https://help.github.com/articles/about-merge-methods-on-github/
How to set the committer of a new commit?
The best I could find was using the environment variables to override the committer:
GIT_COMMITTER_NAME='a' GIT_COMMITTER_EMAIL='a' git commit --author 'a <a>'
How to get the committer and commit date of a given commit?
Only author data shows by default on git log
.
To see the committer date you can either:
format the log specifically for that:
git log --pretty='%cn %cd' -n1 HEAD
where
cn
andcd
stand forCommitter Name
andCommitter Date
use the
fuller
predefined format:git log --format=fuller
go low level and show the entire commit data:
git cat-file -p HEAD
How to set the committer date of a new commit?
git commit --date
only sets the author date: for the committer date the best I could find was with the environment variable:
GIT_COMMITTER_DATE='2000-01-01T00:00:00+0000' git commit --date='2000-01-01T00:00:00+0000'
See also: What is the difference between author and committer in Git?
How Git stores author vs committer internally?
See: What is the file format of a git commit object?
Basically, the commit is a text file, and it contains two line separated fields:
author {author_name} <{author_email}> {author_date_seconds} {author_date_timezone}
committer {committer_name} <{committer_email}> {committer_date_seconds} {committer_date_timezone}
This makes it clear that both are two completely independent data entries in the commit object.
@Ciro Santilli 新疆改造中心 六四事件 法轮功 proposed to use
GIT_COMMITTER_NAME='a' GIT_COMMITTER_EMAIL='a' git commit --author 'a <a>'
To avoid repeating the name and email, you can reuse them
GIT_COMMITTER_NAME='a'; GIT_COMMITTER_EMAIL='a'; git commit --author "$GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>"
which first sets the variables in separate commands, then uses them for the git commit
call (note the double parentheses).
참고URL : https://stackoverflow.com/questions/18750808/difference-between-author-and-committer-in-git
'Programming' 카테고리의 다른 글
서로 다른 운영 체제 사이에서 줄 끝 변환이 git core.autocrlf와 작동하는 방식 (0) | 2020.05.06 |
---|---|
최신 C ++로 무료 성능을 얻을 수 있습니까? (0) | 2020.05.06 |
Git에서 루트 커밋 앞에 커밋을 삽입 하시겠습니까? (0) | 2020.05.05 |
오류 만들기 : 구분 기호 누락 (0) | 2020.05.05 |
설치된 판다 버전을 찾는 방법 (0) | 2020.05.05 |