programing

복제된 원격 저장소와 원래 원격 저장소 간의 차이

javajsp 2023. 6. 28. 21:19

복제된 원격 저장소와 원래 원격 저장소 간의 차이

github 저장소를 복제했으며 로컬에서 변경한 내용이 없습니다.Github 저장소가 동일한 분기에서 커밋을 사용하여 앞으로 이동했습니다.

  1. 로컬 리포지토리와 원래 github 리포지토리 사이의 차이점을 찾으려면 어떻게 해야 합니까?
  2. 내 작업 복사본과 원래 github 저장소 사이에 차이점을 찾으려면 어떻게 해야 합니까?
  3. 로컬 저장소와 동일한 프로젝트의 다른 깃허브 저장소 간에 차이점을 찾으려면 어떻게 해야 합니까?

비교할 원격 리포지토리를 추가합니다.

git remote add foobar git://github.com/user/foobar.git

원격의 로컬 복사본을 업데이트합니다.

git fetch foobar

가져오기는 작업 복사본을 변경하지 않습니다.

로컬 저장소에 있는 모든 지점과 추가한 원격 지점을 비교:

git diff master foobar/master

질문에 대한 또 다른 답변(마스터에 있고 원격 변경 사항에 대해 다시 인식할 수 있도록 "gitfetch origin"을 이미 수행했다고 가정):

로컬 분기가 생성된 이후 원격 분기에서 커밋:

git diff HEAD...origin/master

"작업 복사본"은 아직 원격에 없는 로컬 커밋이 있는 로컬 지점을 의미합니다.로컬 분기에 있지만 원격 분기 실행에는 존재하지 않는 항목의 차이를 확인하려면 다음을 수행합니다.

git diff origin/master...HEAD

dvyrne의 답을 보세요.

이 예는 누군가에게 도움이 될 수 있습니다.

참고 "origin원격 "What is on Github"에 대한 내 별칭입니다.
참고 "mybranchgithub과 동기화하는 내 브랜치 "What is local"에 대한 내 별칭입니다.
--지점 이름을 만들지 않은 경우 '마스터'입니다.하지만 저는 다른 이름을 사용하고 있습니다.mybranch분기 이름 매개 변수가 사용되는 위치를 표시합니다.


github의 원격 저장소는 정확히 무엇입니까?

$ git remote -v
origin  https://github.com/flipmcf/Playground.git (fetch)
origin  https://github.com/flipmcf/Playground.git (push)

"같은 코드의 다른 github 저장소"를 추가합니다. 이를 포크라고 합니다.

$ git remote add someOtherRepo https://github.com/otherUser/Playground.git

$git remote -v
origin  https://github.com/flipmcf/Playground.git (fetch)
origin  https://github.com/flipmcf/Playground.git (push)
someOtherRepo https://github.com/otherUser/Playground.git (push)
someOtherRepo https://github.com/otherUser/Playground.git (fetch)

지역 담당자가 최신 상태인지 확인하십시오.

$ git fetch

로컬에서 몇 가지 사항을 클릭합니다.예를 들어 file./foo/bar.py .

$ git status
# On branch mybranch
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#   modified:   foo/bar.py

커밋되지 않은 변경사항 검토

$ git diff mybranch
diff --git a/playground/foo/bar.py b/playground/foo/bar.py
index b4fb1be..516323b 100655
--- a/playground/foo/bar.py
+++ b/playground/foo/bar.py
@@ -1,27 +1,29 @@
- This line is wrong
+ This line is fixed now - yea!
+ And I added this line too.

로컬로 커밋합니다.

$ git commit foo/bar.py -m"I changed stuff"
[myfork 9f31ff7] I changed stuff
1 files changed, 2 insertions(+), 1 deletions(-)

이제, 나는 내 리모컨(기트허브)과 다릅니다.

$ git status
# On branch mybranch
# Your branch is ahead of 'origin/mybranch' by 1 commit.
#
nothing to commit (working directory clean)

원격으로 이 문제를 해결합니다. - 포크: (이것은 자주 사용됩니다.)git diff master origin)

$ git diff mybranch origin
diff --git a/playground/foo/bar.py b/playground/foo/bar.py
index 516323b..b4fb1be 100655
--- a/playground/foo/bar.py
+++ b/playground/foo/bar.py
@@ -1,27 +1,29 @@
- This line is wrong
+ This line is fixed now - yea!
+ And I added this line too.

(원격에 적용하기 위해 버튼을 누름)

내 원격 분기와 원격 마스터 분기는 어떻게 다릅니까?

$ git diff origin/mybranch origin/master

로컬 항목이 원격 마스터 분기와 어떻게 다릅니까?

$ git diff origin/master

내 물건이 다른 사람의 포크, 같은 레포의 마스터 브랜치와 어떻게 다릅니까?

$git diff mybranch someOtherRepo/master

언급URL : https://stackoverflow.com/questions/5162800/git-diff-between-cloned-and-original-remote-repository