upstream deleted files showing as added in git diffHow to remove local (untracked) files from the current Git working tree?What is the difference between 'git pull' and 'git fetch'?How do I undo 'git add' before commit?How do I undo the most recent local commits in Git?How do I force “git pull” to overwrite local files?How do I show the changes which have been staged?How do I check out a remote Git branch?How do I delete a Git branch locally and remotely?How do I revert a Git repository to a previous commit?How do I rename a local Git branch?

Why didn't Caesar move against Sextus Pompey immediately after Munda?

How would one prevent political gerrymandering?

Robots in a spaceship

Equatorial oceanic river caused by tides

What election rules and voting rights are guaranteed by the US Constitution?

Why would Dementors torture a Death Eater if they are loyal to Voldemort?

Magento2: Custom module not working

How does the 'five minute adventuring day' affect class balance?

Where can I find my serialized Sitecore items?

Is leaving out prefixes like "rauf", "rüber", "rein" when describing movement considered a big mistake in spoken German?

How useful would a hydroelectric power plant be in the post-apocalypse world?

Reusable spacecraft: why still have fairings detach, instead of open/close?

"I am [the / an] owner of a bookstore"?

What was the point of separating stdout and stderr?

The alcoholic village festival

How do I keep a running total of data in a column in Excel?

Why did the Apple //e make a hideous noise if you inserted the disk upside down?

Why isn't UDP with reliability (implemented at Application layer) a substitute of TCP?

What was the first science fiction or fantasy multiple choice book?

How far can gerrymandering go?

How do I present a future free of gender stereotypes without being jarring or overpowering the narrative?

Early 2000s movie about time travel, protagonist travels back to save girlfriend, then into multiple points in future

Meaning of the word "good" in context

Tricolour nonogram



upstream deleted files showing as added in git diff


How to remove local (untracked) files from the current Git working tree?What is the difference between 'git pull' and 'git fetch'?How do I undo 'git add' before commit?How do I undo the most recent local commits in Git?How do I force “git pull” to overwrite local files?How do I show the changes which have been staged?How do I check out a remote Git branch?How do I delete a Git branch locally and remotely?How do I revert a Git repository to a previous commit?How do I rename a local Git branch?













2















In the PR interface on GitHub, I can see the new changes that I've made to my branch as a diff against the master branch.



I'd like to get a list of these files from the command line.



An issue arises (on the command line) when a file was deleted on the target branch I'm diffing against (e.g. master) but my branch isn't aware of this change.



  1. Create git repo and add file a to master.

  2. Create branch add-b from master and add a file b. Don't merge.

  3. Switch back to master and remove a. Commit.

  4. Switch back to branch add-b and run git diff --name-only --diff-filter=A master, which shows both a and b as having been added.

Given that git checkout master && git merge add-b will not re-add the file a to the repo, I understand there must be some mechanism whereby git figures this out and imagine there is a way to bubble up this information.



What command(s) must I run to only show added / modified files, and avoid ones that have been deleted on the target branch?




Edit - example for clarity



• ~/src/git-testing $$$ git init
Initialized empty Git repository in /Users/ryan.tuck/src/git-testing/.git/
• ~/src/git-testing $$$ touch a && git add . && git commit -m 'add a'
[master (root-commit) f65661b] add a
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 a
• ~/src/git-testing $$$ git checkout -b add-b
Switched to a new branch 'add-b'
• ~/src/git-testing $$$ touch b
• ~/src/git-testing $$$ git add . && git commit -m 'add b'
[add-b 588960f] add b
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 b
• ~/src/git-testing $$$ ls
a b
• ~/src/git-testing $$$ git checkout master
Switched to branch 'master'
• ~/src/git-testing $$$ ls
a
• ~/src/git-testing $$$ rm a && git add . && git commit -m 'remove a'
[master 2b4d9f8] remove a
1 file changed, 0 insertions(+), 0 deletions(-)
delete mode 100644 a
• ~/src/git-testing $$$ ls
• ~/src/git-testing $$$ git checkout add-b
Switched to branch 'add-b'
• ~/src/git-testing $$$ git diff --name-only --diff-filter=A master
a
b









share|improve this question
























  • I guess on step 3 you created rm-a from master as well, is that right?

    – eftshift0
    Mar 25 at 16:21















2















In the PR interface on GitHub, I can see the new changes that I've made to my branch as a diff against the master branch.



I'd like to get a list of these files from the command line.



An issue arises (on the command line) when a file was deleted on the target branch I'm diffing against (e.g. master) but my branch isn't aware of this change.



  1. Create git repo and add file a to master.

  2. Create branch add-b from master and add a file b. Don't merge.

  3. Switch back to master and remove a. Commit.

  4. Switch back to branch add-b and run git diff --name-only --diff-filter=A master, which shows both a and b as having been added.

Given that git checkout master && git merge add-b will not re-add the file a to the repo, I understand there must be some mechanism whereby git figures this out and imagine there is a way to bubble up this information.



What command(s) must I run to only show added / modified files, and avoid ones that have been deleted on the target branch?




Edit - example for clarity



• ~/src/git-testing $$$ git init
Initialized empty Git repository in /Users/ryan.tuck/src/git-testing/.git/
• ~/src/git-testing $$$ touch a && git add . && git commit -m 'add a'
[master (root-commit) f65661b] add a
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 a
• ~/src/git-testing $$$ git checkout -b add-b
Switched to a new branch 'add-b'
• ~/src/git-testing $$$ touch b
• ~/src/git-testing $$$ git add . && git commit -m 'add b'
[add-b 588960f] add b
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 b
• ~/src/git-testing $$$ ls
a b
• ~/src/git-testing $$$ git checkout master
Switched to branch 'master'
• ~/src/git-testing $$$ ls
a
• ~/src/git-testing $$$ rm a && git add . && git commit -m 'remove a'
[master 2b4d9f8] remove a
1 file changed, 0 insertions(+), 0 deletions(-)
delete mode 100644 a
• ~/src/git-testing $$$ ls
• ~/src/git-testing $$$ git checkout add-b
Switched to branch 'add-b'
• ~/src/git-testing $$$ git diff --name-only --diff-filter=A master
a
b









share|improve this question
























  • I guess on step 3 you created rm-a from master as well, is that right?

    – eftshift0
    Mar 25 at 16:21













2












2








2








In the PR interface on GitHub, I can see the new changes that I've made to my branch as a diff against the master branch.



I'd like to get a list of these files from the command line.



An issue arises (on the command line) when a file was deleted on the target branch I'm diffing against (e.g. master) but my branch isn't aware of this change.



  1. Create git repo and add file a to master.

  2. Create branch add-b from master and add a file b. Don't merge.

  3. Switch back to master and remove a. Commit.

  4. Switch back to branch add-b and run git diff --name-only --diff-filter=A master, which shows both a and b as having been added.

Given that git checkout master && git merge add-b will not re-add the file a to the repo, I understand there must be some mechanism whereby git figures this out and imagine there is a way to bubble up this information.



What command(s) must I run to only show added / modified files, and avoid ones that have been deleted on the target branch?




Edit - example for clarity



• ~/src/git-testing $$$ git init
Initialized empty Git repository in /Users/ryan.tuck/src/git-testing/.git/
• ~/src/git-testing $$$ touch a && git add . && git commit -m 'add a'
[master (root-commit) f65661b] add a
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 a
• ~/src/git-testing $$$ git checkout -b add-b
Switched to a new branch 'add-b'
• ~/src/git-testing $$$ touch b
• ~/src/git-testing $$$ git add . && git commit -m 'add b'
[add-b 588960f] add b
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 b
• ~/src/git-testing $$$ ls
a b
• ~/src/git-testing $$$ git checkout master
Switched to branch 'master'
• ~/src/git-testing $$$ ls
a
• ~/src/git-testing $$$ rm a && git add . && git commit -m 'remove a'
[master 2b4d9f8] remove a
1 file changed, 0 insertions(+), 0 deletions(-)
delete mode 100644 a
• ~/src/git-testing $$$ ls
• ~/src/git-testing $$$ git checkout add-b
Switched to branch 'add-b'
• ~/src/git-testing $$$ git diff --name-only --diff-filter=A master
a
b









share|improve this question
















In the PR interface on GitHub, I can see the new changes that I've made to my branch as a diff against the master branch.



I'd like to get a list of these files from the command line.



An issue arises (on the command line) when a file was deleted on the target branch I'm diffing against (e.g. master) but my branch isn't aware of this change.



  1. Create git repo and add file a to master.

  2. Create branch add-b from master and add a file b. Don't merge.

  3. Switch back to master and remove a. Commit.

  4. Switch back to branch add-b and run git diff --name-only --diff-filter=A master, which shows both a and b as having been added.

Given that git checkout master && git merge add-b will not re-add the file a to the repo, I understand there must be some mechanism whereby git figures this out and imagine there is a way to bubble up this information.



What command(s) must I run to only show added / modified files, and avoid ones that have been deleted on the target branch?




Edit - example for clarity



• ~/src/git-testing $$$ git init
Initialized empty Git repository in /Users/ryan.tuck/src/git-testing/.git/
• ~/src/git-testing $$$ touch a && git add . && git commit -m 'add a'
[master (root-commit) f65661b] add a
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 a
• ~/src/git-testing $$$ git checkout -b add-b
Switched to a new branch 'add-b'
• ~/src/git-testing $$$ touch b
• ~/src/git-testing $$$ git add . && git commit -m 'add b'
[add-b 588960f] add b
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 b
• ~/src/git-testing $$$ ls
a b
• ~/src/git-testing $$$ git checkout master
Switched to branch 'master'
• ~/src/git-testing $$$ ls
a
• ~/src/git-testing $$$ rm a && git add . && git commit -m 'remove a'
[master 2b4d9f8] remove a
1 file changed, 0 insertions(+), 0 deletions(-)
delete mode 100644 a
• ~/src/git-testing $$$ ls
• ~/src/git-testing $$$ git checkout add-b
Switched to branch 'add-b'
• ~/src/git-testing $$$ git diff --name-only --diff-filter=A master
a
b






git






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 25 at 16:27







Ryan Tuck

















asked Mar 25 at 15:48









Ryan TuckRyan Tuck

2,2583 gold badges32 silver badges49 bronze badges




2,2583 gold badges32 silver badges49 bronze badges












  • I guess on step 3 you created rm-a from master as well, is that right?

    – eftshift0
    Mar 25 at 16:21

















  • I guess on step 3 you created rm-a from master as well, is that right?

    – eftshift0
    Mar 25 at 16:21
















I guess on step 3 you created rm-a from master as well, is that right?

– eftshift0
Mar 25 at 16:21





I guess on step 3 you created rm-a from master as well, is that right?

– eftshift0
Mar 25 at 16:21










1 Answer
1






active

oldest

votes


















2














I think there's no magic in what you are asking there. master has no files, and add-b has both a and b.... so both files have to be added for the diff to make sense..... are you struggling because you think that git is somehow considering the history of a and b (files) when comparing the branches? I don't think that is the case.... not on this example, anyway. Perhaps you would like to use something more like the diff since both branches diverged? If that's the case, try with ...:



git diff master...add-b


That should show you only the addition of b.






share|improve this answer























  • this was exactly what i was looking for to get just b to show up - thanks!

    – Ryan Tuck
    Mar 25 at 18:13










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55341621%2fupstream-deleted-files-showing-as-added-in-git-diff%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














I think there's no magic in what you are asking there. master has no files, and add-b has both a and b.... so both files have to be added for the diff to make sense..... are you struggling because you think that git is somehow considering the history of a and b (files) when comparing the branches? I don't think that is the case.... not on this example, anyway. Perhaps you would like to use something more like the diff since both branches diverged? If that's the case, try with ...:



git diff master...add-b


That should show you only the addition of b.






share|improve this answer























  • this was exactly what i was looking for to get just b to show up - thanks!

    – Ryan Tuck
    Mar 25 at 18:13















2














I think there's no magic in what you are asking there. master has no files, and add-b has both a and b.... so both files have to be added for the diff to make sense..... are you struggling because you think that git is somehow considering the history of a and b (files) when comparing the branches? I don't think that is the case.... not on this example, anyway. Perhaps you would like to use something more like the diff since both branches diverged? If that's the case, try with ...:



git diff master...add-b


That should show you only the addition of b.






share|improve this answer























  • this was exactly what i was looking for to get just b to show up - thanks!

    – Ryan Tuck
    Mar 25 at 18:13













2












2








2







I think there's no magic in what you are asking there. master has no files, and add-b has both a and b.... so both files have to be added for the diff to make sense..... are you struggling because you think that git is somehow considering the history of a and b (files) when comparing the branches? I don't think that is the case.... not on this example, anyway. Perhaps you would like to use something more like the diff since both branches diverged? If that's the case, try with ...:



git diff master...add-b


That should show you only the addition of b.






share|improve this answer













I think there's no magic in what you are asking there. master has no files, and add-b has both a and b.... so both files have to be added for the diff to make sense..... are you struggling because you think that git is somehow considering the history of a and b (files) when comparing the branches? I don't think that is the case.... not on this example, anyway. Perhaps you would like to use something more like the diff since both branches diverged? If that's the case, try with ...:



git diff master...add-b


That should show you only the addition of b.







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 25 at 16:25









eftshift0eftshift0

7,3261 gold badge12 silver badges22 bronze badges




7,3261 gold badge12 silver badges22 bronze badges












  • this was exactly what i was looking for to get just b to show up - thanks!

    – Ryan Tuck
    Mar 25 at 18:13

















  • this was exactly what i was looking for to get just b to show up - thanks!

    – Ryan Tuck
    Mar 25 at 18:13
















this was exactly what i was looking for to get just b to show up - thanks!

– Ryan Tuck
Mar 25 at 18:13





this was exactly what i was looking for to get just b to show up - thanks!

– Ryan Tuck
Mar 25 at 18:13






Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55341621%2fupstream-deleted-files-showing-as-added-in-git-diff%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현