Committing files in the Git repository

In Git, new or modified files are staged for commit. To see the staged files, click on the Git Staging tab in the Git perspective:

Figure 3.20: The Git Staging view

If you do not want to add a file to the Git repository, then right-click on that file (or multiple files selection) and select the Ignore option. Before you commit files to Git, you need to move Unstaged Changes to Staged Changes. We are going to add all the files to Git. So select all the files in the Unstaged Changes view and drag and drop them in the Staged Changes view. It is also recommended to set Author name and Committer. It is usually in Name <email> format. To set this option at global level in Eclipse (so that you do not have to set these fields at every commit), go to Eclipse Preferences and search for Git. Then go to the Team | Git | Configuration page and click the Add Entry... button:

Figure 3.21: Adding a Git configuration entry

Similarly, add the user.email entry:

Figure 3.22: Git configurations in Preferences

Coming back to the Git Staging view, enter Author, Committer, and Commit Message. Then click the Commit button.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.133.61