简体   繁体   中英

How to easily Git commit in Eclipse Neon

I just upgraded to Eclipse Neon from Mars. Earlier I could just select "Commit" from the "Team" menu, and the dialog would provide checkboxes for the files I wanted to stage. I could easily hit "select all" and all files would be staged. In fact, the files already in the repository would already be checked, if I remember correctly.

Now Eclipse Neon doesn't pop up a dialog, but shows a "Git Staging" view tab. The modified files are listed as "Unstaged Changes". Yes, I'm familiar with the Git workflow, but this seems a step backwards for the Eclipse UI. How do I "stage" the file? Do I have to select them and drag-and-drop them to "Staged Changes"? Do I have to right click on them and add them to the Index?

Whatever happens, it won't let me just hit the "Commit" button---it will complain that there are no unstaged files. Am I missing some way to commit that was as easy as it was in Eclipse Mars, with auto-staging of files or at least a "stage all" button?

For the time being I'm disabling the Staging View in Windows > Preferences> Team > Git > Committing, opting to use the old-fashioned Commit Dialog (the one from Eclipse Mars) instead. I don't have time to muck around with extra listbox selections, mouse clicks, and context menu selections just to commit my code.

I hope someone else comes up with a better answer. The Git Staging View was interesting... but not if it slows me down.

Select YourProject --> Team --> Commit... , A Git Staging console will open.

Now follow below steps for Commit or Commit and Push changes...

  1. There are two ways to add files in Staged Changes:

    • drag and drop the corresponding tree node to the staged changes pane. 在此输入图像描述
      • click " Add to Git Index " from the context menu. 在此输入图像描述
  2. Enter the commit message . 在此输入图像描述

  3. Click " Commit " or " Commit & Push "

There is a default option in Preferences>Git>Commiting : "Automatically stage selected ressources on commit". If this option is checked, all modified files - but with a previous version commited - will be staged automatically as you commit.

So this is only when you're adding completely new files to the project that you have to stage them. This is the same with the old dialog where you have to select new files, while the modified files are already selected.

Another tip to speed up the commit process is that :

1) The focus is already in the commit message box.

2) You can hit CTRL + ENTER to commit when you've finished the message.

I would like to add that creating a local directory on your computer might be a useful idea. Then create a simple text file, put it in that local directory and do a Commit and push to your personal git repo.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM