SimpleDesk

Community => SimpleDesk Team Blog => Topic started by: SleePy on December 13, 2015, 06:53:51 pm

Title: How To: Git Submissions with SourceTree
Post by: SleePy on December 13, 2015, 06:53:51 pm
Heres a quick tutorial on how to do Git Submissions with SourceTree.app
Our Git repository is at: https://github.com/simpledesk/simpledesk

After navigating there you will need to fork the repository to your own profile.
(https://www.simpledesk.net/community/proxy.php?request=http%3A%2F%2Fi.imgur.com%2Fx5D2F1Ll.png%3F1&hash=9720d4a1efa63b187ae4f6a80d411747) (http://i.imgur.com/x5D2F1L.png?1)

Copy the HTTPS or SSH address into your clipboard.
(https://www.simpledesk.net/community/proxy.php?request=http%3A%2F%2Fi.imgur.com%2Fv5TegaCl.png%3F1&hash=ecffcdf9ffc4d8c6213b047a72400291) (http://i.imgur.com/v5TegaC.png?1)

In SourceTree.app choose New Repository
(https://www.simpledesk.net/community/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FxTuP6V8l.png%3F1&hash=3f7551e2b495426ec07800da4370f114) (http://i.imgur.com/xTuP6V8.png?1)

For this we will clone from URL
(https://www.simpledesk.net/community/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FRyG1v4hl.png%3F1&hash=e38ccca44dc88553c3552096238c5e45) (http://i.imgur.com/RyG1v4h.png?1)

Fill out the information
(https://www.simpledesk.net/community/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FHYQn8Uxl.png%3F1&hash=3c443b4c8f57c58360b711a74c4e8630) (http://i.imgur.com/HYQn8Ux.png?1)
(https://www.simpledesk.net/community/proxy.php?request=http%3A%2F%2Fi.imgur.com%2Fm7BP1BDl.png%3F1&hash=abd99c9146d0aaecf1004a946b663ca4) (http://i.imgur.com/m7BP1BD.png?1)

All work should be done in branches.  It makes it easier to work with additional separate commits.  You should have the master branch checked out when creating a new branch.
(https://www.simpledesk.net/community/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FaBXwgj8l.png%3F1&hash=4da6d678131d9d2b7bed4c5f800d2e74) (http://i.imgur.com/aBXwgj8.png?1)
(https://www.simpledesk.net/community/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FrvMtWMpl.png%3F1&hash=7de0fc803b42df9a4bcdf45644b12b4f) (http://i.imgur.com/rvMtWMp.png?1)
(https://www.simpledesk.net/community/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FxPFYa2Nl.png%3F1&hash=9ace3d554ec87324248c422f848acd87) (http://i.imgur.com/xPFYa2N.png?1)

At this point you are safe to make changes.  You are working on your local branch.  When you are ready to make commits return to SourceTree.app
(https://www.simpledesk.net/community/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FzwWoegbl.png%3F2&hash=3c6b2392aeb00fd507c3f3dc8a1893f0) (http://i.imgur.com/zwWoegb.png?2)

Select all the files you wish to include in the commit, Setup your commit message and Choose Sign Off from the commit options (far as I can tell in SourceTree this option persists only from the same branch while running SourceTree and is reset easily).  Using the keyword "Fixes #1234" Causes the issue to be closed once the PR is approved.  Just using the reference causes a notice about a reference to the issue.
(https://www.simpledesk.net/community/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FzwWoegbl.png%3F2&hash=3c6b2392aeb00fd507c3f3dc8a1893f0) (http://i.imgur.com/zwWoegb.png?2)

Now that you have committed you will want to push changes back up to your repository.  Choose Push and make sure to select your repository and working branch (avoid submitting changes to master).
(https://www.simpledesk.net/community/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FlK9uOFml.png%3F1&hash=6b1c6273e72a4636ee8b822e32f89c30) (http://i.imgur.com/lK9uOFm.png?1)

Back on GitHub you will see a new button showing up on your repository.  Click the Compare & pull request button to start the process.
(https://www.simpledesk.net/community/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FnQJGqK3l.png%3F1&hash=8ea1ac1fdb05fa5b8aa906d69fe7963d) (http://i.imgur.com/nQJGqK3.png?1)

Make sure you have the proper branches selected.  Fill out your commit message.
(https://www.simpledesk.net/community/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FeznOT9Cl.png%3F1&hash=739e433c918237e54fbab5d1c7c67a65) (http://i.imgur.com/eznOT9C.png?1)

Once you do that, the new issue is created under the SimpleDesk issues.  As you can see, if the PR is mergable and you have rights to the repository to make changes, a simple merge button exists.
(https://www.simpledesk.net/community/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FeznOT9Cl.png%3F1&hash=739e433c918237e54fbab5d1c7c67a65) (http://i.imgur.com/eznOT9C.png?1)



Now your repository will not stay in sync with SimpleDesks without intervention.  As you can see from this example, it does not have the latest commits from the master SimpleDesk repository.
(https://www.simpledesk.net/community/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FxaygC1cl.png%3F1&hash=3d11d749c89d9244caebdd599a0ba063) (http://i.imgur.com/xaygC1c.png?1)

Make sure to change back to the default branch.  Choose Repository and Repository Settings.  The location of this may differ for the Windows edition of SourceTree
(https://www.simpledesk.net/community/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FMzxY8GXl.png%3F1&hash=fa6a1a0481bcf51866aba47ec216bc4a) (http://i.imgur.com/MzxY8GX.png?1)

Click Add on Repository
(https://www.simpledesk.net/community/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FcjyvmPDl.png%3F1&hash=a463a68c8849a2465dc1a1e0f4ffb7a7) (http://i.imgur.com/cjyvmPD.png?1)

Name it upstream (or anyname and use the url: git@github.com:SimpleDesk/SimpleDesk.git
(https://www.simpledesk.net/community/proxy.php?request=http%3A%2F%2Fi.imgur.com%2F4wKguZWl.png%3F1&hash=d25393d96aee3acd153af92accf23598) (http://i.imgur.com/4wKguZW.png?1)

After adding it, fetch the new repository
(https://www.simpledesk.net/community/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FG3aBnj3l.png%3F1&hash=7352a3442d8eaebf9dd13e24bf0c4da5) (http://i.imgur.com/G3aBnj3.png?1)

Now pull changes down, make sure to bring it from the upstream's proper branch.  It will merge into your current working branch.
(https://www.simpledesk.net/community/proxy.php?request=http%3A%2F%2Fi.imgur.com%2Fqblq8b2l.png%3F2&hash=0fae8f9bc813189704007b3084be9e91) (http://i.imgur.com/qblq8b2.png?2)

Now push changes back up to your (origin) repository and proper branch
(https://www.simpledesk.net/community/proxy.php?request=http%3A%2F%2Fi.imgur.com%2F8ZlNSmsl.png%3F1&hash=a6631b296cb7aebfe797934c4f2501e6) (http://i.imgur.com/8ZlNSms.png?1)

At this point you are synced with the master repo.
Title: Re: How To: Git Submissions with SourceTree
Post by: wintstar on December 13, 2015, 06:57:08 pm
 :) Many thanks