Skip to content
This repository has been archived by the owner on May 8, 2024. It is now read-only.

Change GitChanges so it compares against the remote #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jdonaghue
Copy link

The previous version was comparing against HEAD1 which would:
A. Miss any changes prior to that of the last commit that had not yet been pushed
B. Grab changes not necessarily made by the current user (for example
if the current user only had staged changes but no commits, HEAD
1 would grab
those changes as well as the changes from the last commit)

The previous version was comparing against HEAD~1 which would:
A. Miss any changes prior to that of the last commit that had not yet been pushed
B. Grab changes not necessarily made by the current user (for example
if the current user only had staged changes but no commits, HEAD~1 would grab
those changes as well as the changes from the last commit)
@jdonaghue
Copy link
Author

hmmm looks like the ci build timed out

@vvakame vvakame self-assigned this Mar 22, 2016
@vvakame
Copy link
Member

vvakame commented Mar 26, 2016

sorry for late reply. thank you for your contributions.

hmmm looks like the ci build timed out

it is not you matter. don't worry.
We want to resolve it. but it is too heavy 😿

please check my understanding first.

freshpaint-0-2016 03 27-01 06 53

I tried git diff --name-only origin but I can't get expected result.
Do I misunderstand something?

@horiuchi
Copy link
Member

I thought that change can get this command: git diff master...HEAD
It use the ... instead of ...

@vvakame
Copy link
Member

vvakame commented Mar 28, 2016

cool! it can't pick up unstaged changes. but it is better than now.

@@ -18,6 +18,9 @@ optimist.boolean('single-thread');
optimist.boolean('changes');
optimist.default('changes', false);

optimist.string('git-remote');
optimist.default('git-remote', 'origin');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please replace origin to master...HEAD

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only reason I didn't opt for that approach was that it always compares against master. What I was going for with the origin approach was to compare against the current branch's tracked remote branch. The issue you might be seeing is that the branch you are working off of doesn't exist in the remote repo. I am not sure I tested that case, but I will do so shortly to confirm.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm I just ran git diff --name-only origin on a brach that isn't in the remote repo and it worked correctly for me (showing in the diagram above both the committed and unstaged changes that were not yet pushed to origin, essentially everything I have done locally since the last pull/rebase).

What were you seeing for results?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is your remote named origin? I am assuming yes because that is the default behavior, but just double checking.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for late reply.
I tried git diff --name-only origin. but it failed.

$  git branch
* jdonaghue-master
  master
  refactor-code-format
  use-es6-default
$ git diff --name-only origin
fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

is that command works fine in all situations?

$ git remote -v                                                                                                                 128 ↵
base    git@github.com:DefinitelyTyped/definition-tester.git (fetch)
base    git@github.com:DefinitelyTyped/definition-tester.git (push)
origin  git@github.com:vvakame/definition-tester.git (fetch)
origin  git@github.com:vvakame/definition-tester.git (push)
$ git diff --name-only base
fatal: ambiguous argument 'base': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants