Upgrade to Pro — share decks privately, control downloads, hide ads and more …

SmartGit - installing, cloning, pushing, pulli...

leveton
May 13, 2012
390

SmartGit - installing, cloning, pushing, pulling, resolving conflicts

leveton

May 13, 2012
Tweet

Transcript

  1. SmartGit The best GUI for Git and Github Allows you

    to clone, branch, merge, push, pull, and resolve conflicts all through a nice interface
  2. 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).
  3. Using SmartGit Open SmartGit and make sure that the 'Main'

    toggle button is selected at the upper-right
  4. cloning a repo from Github Go to project > clone.

    If SmartGit asks for your private key, it should be in C:\Users\<your username>\.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'
  5. 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
  6. 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.
  7. 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.
  8. 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.
  9. 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...
  10. working in your local Master Notice the 'second commit' Commit

    Message. Git requires that you create a message before committing.
  11. 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
  12. 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
  13. 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...
  14. 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...
  15. resolving conflicts the solution is to pull but only 'fetch'

    the changes (see the pic below), resolve the conflict manually, and then push
  16. 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 <<<<HEAD and ===== is your local change, between ===== and >>>>Origin/Master is what's on Github - the remote master.
  17. 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.