News:

Loving SimpleDesk? Help us spread the word!

Main Menu

How To: Git Submissions with SourceTree

Started by SleePy, December 13, 2015, 06:53:51 PM

Previous topic - Next topic

SleePy

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.
"GitHub Profile with SimpleDesk"

Copy the HTTPS or SSH address into your clipboard.
"GitHub Clone Action"

In SourceTree.app choose New Repository
"Source Tree Setup New repo"

For this we will clone from URL
"Source Tree with Clone from URL selected"

Fill out the information
"Source Tree New Clone from URL Window"
"Example of Source Tree with data filled out"

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.
"New Branch Action"
"New Branch Popup window"
"New Branch Completed"

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
"Files modified showing in Source Tree"

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.
"Local Files modified"

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).
"Pushing to GitHub"

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

Make sure you have the proper branches selected.  Fill out your commit message.
"New PR screen"

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.
"New PR screen valid"



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.
"Source Tree showing your branch committed"

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
"Source Tree Repository settings"

Click Add on Repository
"Source Tree Respository settings popup"

Name it upstream (or anyname and use the url: [email protected]:SimpleDesk/SimpleDesk.git
"Making new remote"

After adding it, fetch the new repository
"Fetching new remote repository"

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

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

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

wintstar