Help with SourceTree

I have decided on SourceTree/GitHub for VCS. Have it installed and linked to my GitHub Account. Created a repository and put my current project code in it and did an initial commit. So far so good, but now I’m confused.

I want to check-out and edit the code. How do I do that. Do I edit the code directly in the SourceTree Repository? Clone the local Repository and edit the clone. Then I assume I can push the changes back to the original repository.

I could not find a basic project editing workflow either on the ST site or YouTube. Guidance Please my friends.

Hi Bill,

It might be easier to explain with a simple example.
Assume I have a Xojo app that I want to put under version control. Let’s also assume that it is a working release (1.0).
I initialize a git repository in the root directory for the project. (git init)
Add the files to the staging area for git (git add *)
Then commit the changes to the LOCAL repository. (git commit -m “initial commit”)
Now I need to push those changes to the REMOTE repository (git push origin)
Now the LOCAL & REMOTE repositories are in sync.
Currently everything has been done in the “MASTER” branch.
Now you are ready to start working on your next release so you create a branch called “Dev_Next_Release”
(git checkout -b Dev_Next_Release)
You make some changes in this branch, add the files, commit, and then push them to the origin. That is your “cycle” so to speak. You would do that each time you work in that branch.
Now you are done. You are ready to make all these changes part of release #2. You merge your development branch “Dev_Next_Release” into your release branch “MASTER” and tag it as Release #2
(git checkout master
git merge Dev_Next_Release {NOTE: you are in the master branch when you do this}
resolve any conflicts that happened as part of the merge
git tag 2.0
git push origin master {this then pushes the master branch back to the remote (github) repository}
That is a HIGH level approach. Since you are in SourceTree many of these command line commands are done in the GUI.
One thing you need to keep in mind though: when you change branches you need to exit out of your code editor first and then re-open it so that you get the correct set of files for that particular branch.

Lastly keep in mind that this is a VERY simple example and I have left out steps in order to communicate the process.

Craig, You may have used a very simple example but is the best workflow documentation I have found yet. The part I had confused (because of other non-git apps I have looked at) was that the repository is created right in my existing project folder. That made most everything else make more sense.

THANK YOU SO MUCH Craig! This was a huge help.


You are welcome Bill!