Slide 1

Slide 1 text

SmartGit The best GUI for Git and Github Allows you to clone, branch, merge, push, pull, and resolve conflicts all through a nice interface

Slide 2

Slide 2 text

Downloading and Installing SmartGit download - http://www.syntevo.com/smartgit/download.html unpack the zip hit setup exe In the license window, MAKE SURE that you check that you will be using this for non-commercial use so that you get the product for free (a small white lie).

Slide 3

Slide 3 text

Using SmartGit Open SmartGit and make sure that the 'Main' toggle button is selected at the upper-right

Slide 4

Slide 4 text

cloning a repo from Github Go to project > clone. If SmartGit asks for your private key, it should be in C:\Users\\.ssh\ check 'Remote Git, Mercurial or SVN repo' radio button and enter this address https://[email protected]/sdsol- tech/git_training You should be prompted for your Github password and then asked to specify a LOCAL directory in which to store your project you are then asked to name your project, you should give it the same name as the repo, in our case 'git_training'

Slide 5

Slide 5 text

cloning a repo from Github in the 'Output' window you should see the result of your clone You now have a local master directory of the project

Slide 6

Slide 6 text

The SmartGit Workflow We will now: 1. edit some files in our project. 2. stage the edits so that Git knows the changes exist. 3. commit the files. 4. pull from the master Github branch in case any of our teammates have made changes. 5. merge conflicts if any have occurred. 6. push our changes to the remote Master on Github.

Slide 7

Slide 7 text

working in your local Master Now edit a file in git_training/ go to git_training/public/index.html, make a change, and save the edited file. now in SmartGit, switch to the 'Review' tab at the upper right. In the files window, you'll see that 'index.html' has been modified.

Slide 8

Slide 8 text

working in your local Master Click on the file and you'll see the exact changes that you made notice that the exact changed text is highlighted in red.

Slide 9

Slide 9 text

working in your local Master now hit the 'Stage' button at the top-middle - Git now knows that these changes exist. Hit the 'Commit' button at the top-left. You will see a window like this...

Slide 10

Slide 10 text

working in your local Master Notice the 'second commit' Commit Message. Git requires that you create a message before committing.

Slide 11

Slide 11 text

working in your local Master All your changes are staged, committed, and ready to be pushed, BUT do not push to Github yet. Hit 'Pull' at the upper left corner to sync your local master with the remote master If no one has worked on the exact same files that you've worked on, then the pull will go through, if not, then there's a conflict, we'll discuss those later

Slide 12

Slide 12 text

working in your local Master now that you've worked on the project, let Git know about your changes, committed your changes, and updated your local repo in case anyone has worked on the project in the time that you cloned, it's time to push. On the upper left hit 'Push' and you'll see output like this... you should now see your changes on Github

Slide 13

Slide 13 text

resolving conflicts What if Michael works on index.html at the same time that Shafiq works on index.html? If Shafiq commits and pushes first, when I go to sync my local master by pulling, my pull will be rejected...

Slide 14

Slide 14 text

resolving conflicts notice in the last pic that the output is asking you to resolve conflicts first. If I tried to push, then I would get a similar rejection...

Slide 15

Slide 15 text

resolving conflicts the solution is to pull but only 'fetch' the changes (see the pic below), resolve the conflict manually, and then push

Slide 16

Slide 16 text

resolving conflicts any changes that do not conflict, are merged and your local master is updated. Git will display conflicts like this... everything in between <<<>>>Origin/Master is what's on Github - the remote master.

Slide 17

Slide 17 text

resolving conflicts You decide that you like your changes better, so you change the file again. The changes don't have to perfectly match your original change. Now commit and push, and your change should go through.

Slide 18

Slide 18 text

That's it Please contact me at [email protected] if you have any questions. Thanks