Author Topic: How To: Git Submissions with SourceTree  (Read 4792 times)

Offline SleePy

  • Site Manager
  • Developer
  • *
  • Posts: 762
    • View Profile
    • SleePyCode
How To: Git Submissions with SourceTree
« 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.


Copy the HTTPS or SSH address into your clipboard.


In SourceTree.app choose New Repository


For this we will clone from URL


Fill out the information



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.




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


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.


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).


Back on GitHub you will see a new button showing up on your repository.  Click the Compare & pull request button to start the process.


Make sure you have the proper branches selected.  Fill out your commit message.


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.




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.


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


Click Add on Repository


Name it upstream (or anyname and use the url: git@github.com:SimpleDesk/SimpleDesk.git


After adding it, fetch the new repository


Now pull changes down, make sure to bring it from the upstream's proper branch.  It will merge into your current working branch.


Now push changes back up to your (origin) repository and proper branch


At this point you are synced with the master repo.
Jeremy D — Spare-Developer

Offline wintstar

  • Newbie
  • *
  • Posts: 33
  • Carpe diem!
    • View Profile
    • Scaricare
Re: How To: Git Submissions with SourceTree
« Reply #1 on: December 13, 2015, 06:57:08 pm »
 :) Many thanks