Git Clients - Estia-advanced-programming/pandora-public GitHub Wiki

Git Clients

You can use several git clients to manage your project

  • Standalone Git client (an external program)
    • SmartGit: the one presented in first year during the SGV and Project Génie Info Classes. You must update the software and use the license provided on moodle
    • Github Desktop: Simple to use, it only lack the graph view
  • Integrated
    • vscode: vscode comes with a git client and some support for github
    • eclipse: egit

Github Desktop

  • Create a user account on GitHub

  • important Make sure to disable notifications in your settings. We will create more than 100 issues that you will have to take care of (i.e. implement features, functionalities) and mark them as complete. During the creation, you might get an email for each one of them if you don't disable the notifications!

  • Install a git client (e.g., GitHub Desktop)

Github Desktop client

Fig.1 A basic Git Desktop client

  • Click on "clone a repository from the internet”

alt text

Fig.2 Cloning a repository

EGit, the Eclipse Git Plugin

Another possibility is to get everything in one place! (Repository, code, issues, tasks, etc). Check out this tutorial.
Basically, you need to understand that Git can be used with several projects, not only Java and Eclipse. If you understood that, then we can start to look at how some tools (e.g., Eclipse, Visual Studio, etc) integrates Git tools.

For Eclipse, it is called EGit. It can be useful to have a quick access to milestones and issues (Fig.3 - 1) or the branches history (Fig.3 - 2). You can quickly open / close issues, switch branches, commit, push, pull, go back to a previous version just by right-clicking on the project (or just one file), finding the Team menu item, and browsing the options.

alt text

Fig.3 Git in Eclipse

If you already have Git in Eclipse, you should have the Team option when right-clicking on your project (and see some yellow icons to indicate that the project is under version control). If this is the case, just go to the configuration section. Otherwise, perform the install.

Install

  1. In Eclipse, click Help and Install new software...

  2. Click Add source (Fig.4 - 1), then name it egit (or whatever) and write the location to http://download.eclipse.org/egit/updates (Fig.4 - 2)

alt text

Fig.4 Adding an install source in Eclipse

  1. Now select this newly added items, check all packages, and continue the installation.

Configuration

Egit should already know what is going on in your repository: the tool looks into your.git folder, where everything is already configured (remote repository, etc). You might only need to input your login/password the first few times you will trigger commands.

For the task view, you need an additional package.

  1. As in the install section, add a new package repository with a name (e.g., mylin) and this location http://download.eclipse.org/egit/github/updates.

  2. Finish the installation of the package

  3. Then, you can finally set up your tasks repository (or issues, etc) by following this tutorial

Branches

When working with git, you can create, add, delete special tags, which will in turn create what is call branching: your next progress will be identified by this tag. In then end, these tags are useful to track which progress (commit) depend on which previous ones.
This branching is mainly used to develop a feature, a functionality, or anything else that is a little topic on its own. It allows the developer to implement, test, and work on the feature without interfering with the other branches.

To learn more on Git Branching: see this link

Master Branch

The master branch is usually the one where everything works fine. This is the branch we will use to test your program.
It is common to merge and push your current work on 'Master' only when you are sure that:

1- There is no conflict

Make sure you Pull the master branch before trying to push your work. Resolve every potential conflicts locally. With this in mind, you will always push a clean version that any new comers could clone and run.

2- Your current task is complete

It is usually not every 5 minutes that people push on the Master branch. You save your work locally (commit), and push on GitHub on your branch when you reached (or think your reached) a consequent step. You can then merge the branch you were working on with Master when the task at hand is completed. You can then ask your team to review your code and accept the merging via a Pull request.

Pull Request

Summary

  • Create a branch locally
    • Name it develop_yourName_NameOfTheFeature
  • Code, code, code... Debug, code, code, code
  • Commit locally every time that something run
  • When the feature is done: Clean up, Comment
  • Pull the remote code
  • Resolve any conflict that you might have
  • Commit, push, and do a pull request
  • Continue

Resources

Some of the resources used to create this page,
Git handbook

⚠️ **GitHub.com Fallback** ⚠️