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://i.imgur.com/x5D2F1Ll.png?1) (https://i.imgur.com/x5D2F1L.png?1)

Copy the HTTPS or SSH address into your clipboard.
(https://i.imgur.com/v5TegaCl.png?1) (https://i.imgur.com/v5TegaC.png?1)

In SourceTree.app choose New Repository
(https://i.imgur.com/xTuP6V8l.png?1) (https://i.imgur.com/xTuP6V8.png?1)

For this we will clone from URL
(https://i.imgur.com/RyG1v4hl.png?1) (https://i.imgur.com/RyG1v4h.png?1)

Fill out the information
(https://i.imgur.com/HYQn8Uxl.png?1) (https://i.imgur.com/HYQn8Ux.png?1)
(https://i.imgur.com/m7BP1BDl.png?1) (https://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://i.imgur.com/aBXwgj8l.png?1) (https://i.imgur.com/aBXwgj8.png?1)
(https://i.imgur.com/rvMtWMpl.png?1) (https://i.imgur.com/rvMtWMp.png?1)
(https://i.imgur.com/xPFYa2Nl.png?1) (https://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://i.imgur.com/zwWoegbl.png?2) (https://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://i.imgur.com/zwWoegbl.png?2) (https://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://i.imgur.com/lK9uOFml.png?1) (https://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://i.imgur.com/nQJGqK3l.png?1) (https://i.imgur.com/nQJGqK3.png?1)

Make sure you have the proper branches selected.  Fill out your commit message.
(https://i.imgur.com/eznOT9Cl.png?1) (https://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://i.imgur.com/eznOT9Cl.png?1) (https://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://i.imgur.com/xaygC1cl.png?1) (https://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://i.imgur.com/MzxY8GXl.png?1) (https://i.imgur.com/MzxY8GX.png?1)

Click Add on Repository
(https://i.imgur.com/cjyvmPDl.png?1) (https://i.imgur.com/cjyvmPD.png?1)

Name it upstream (or anyname and use the url: [email protected]:SimpleDesk/SimpleDesk.git
(https://i.imgur.com/4wKguZWl.png?1) (https://i.imgur.com/4wKguZW.png?1)

After adding it, fetch the new repository
(https://i.imgur.com/G3aBnj3l.png?1) (https://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://i.imgur.com/qblq8b2l.png?2) (https://i.imgur.com/qblq8b2.png?2)

Now push changes back up to your (origin) repository and proper branch
(https://i.imgur.com/8ZlNSmsl.png?1) (https://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