1

We recently moved to git from svn (both using Eclipse). I am in the (perhaps bad) habit of writing my Java code first, getting everything to work and then going back and adding comments. In SVN this was easy. I would just create a Fisheye review with my Jira task. The review would have a list of all the files I changed and methods I added or modified. I would note it and abandon the review. Then I would edit all the files listed and add the comments.

However, Fisheye does not (I believe) work with git. I could do a git status to see the files I changed but the local branch is already updated so it will not list any files. And all it does is tell me I am something like one commit ahead of the remote branch but does not list any files.

Is there some way to see a lit of the files I have changed with git so I can add comments? And when I say I wait for my comments I really mean mostly for added classes and methods. If I do something like add a line or two to a method I will generally add the comment too.

user85421
  • 28,957
  • 10
  • 64
  • 87
Tony
  • 1,127
  • 1
  • 18
  • 29
  • Are you following a *sane* branching strategy? You can use [`git-show-branch`](https://git-scm.com/docs/git-show-branch) to review the history and gather the list you seek. – Elliott Frisch Jan 07 '18 at 23:07
  • similar to https://stackoverflow.com/questions/1552340/how-to-list-only-the-file-names-that-changed-between-two-commits ? There is a `Compare-With` menu entry in eclipse (right click on project) that allows comparing with a "Branch, Tag or Reference" or "Commit" - I prefer command line, so I am not sure about this in eclipse. – user85421 Jan 08 '18 at 02:56
  • If you have not yet committed the changed files the _Git Staging_ view lists the changed files, otherwise, you will find the changed files in the _History_ view. – howlger Jan 08 '18 at 07:41

2 Answers2

1

changing comments on git commits is not that easy. Each git commit has a sha-checksum which also includes the previous git commit. If you change a commit you change the current commits sha-checksum. therefore you create a new commit. All following commits of your branch must now be rebased on top of this new commit.

The command line provides the git rebase -i [commitid] where you can do lots of modifications including changing comments on commits. I never did this with a GUI but egit might support that too. Just refer documentation on egits rebase feature.

Timothy Truckle
  • 15,071
  • 2
  • 27
  • 51
  • In Eclipse changing a commit message is that easy: in the _History_ view right-click the commit and choose _Modify > Reword_. Note, with Eclipse you only have to know the concept of Git (e. g. rewording a commit message affects all following commits). With Eclipse, the Git command line does not even require to be installed. The fact that you need the rebase command for rewording is not very intuitive and is only true for the Git command line, but not for EGit. – howlger Jan 08 '18 at 08:23
  • Sorry I was probably confusing. I want to see what Java files I changed so I can go and add comments, not to the git commits. – Tony Jan 08 '18 at 12:38
  • I didn't see Carlos' comment. He is correct. Thanks – Tony Jan 08 '18 at 12:39
  • I do have a similar question that pertains to this. I will enter it separately. I found out I can do a synchronize workspace as that shows what has not been pushed yet so that answers this. – Tony Jan 08 '18 at 19:56
0

I found out how to do this.

The "Synchronize Workspace" in eclipse appears to show all the changed files not yet pushed remotely. I have not done any pushes, so this showed me what files changed.

Tony
  • 1,127
  • 1
  • 18
  • 29