I’ve already checked the Unity forum and no one knows anything. No one has the manual. I’ve just visited Discord App website and chatted and no one responded yet.
The following is exactly I have inserted in Discord. I hope someone knows something:
I hope this is the right place to ask about version control. I’ve found lots of information in multiple websites about sourcetree and I don’t know which is new / outdated. I’ve already gone to the official website https://confluence.atlassian.com/get-started-with-sourcetree and it’s for mac users whereas I’m using Windows. Does anyone have the manual or know how to use sourcetree?
As I stated, I got some nasty reply that someone in unity forum wants rewards in exchange for educating me and I think that’s f*******g rude. I would appreciate help here.
SourceTree is a GUI client that supports a couple of “source control” formats that are common and usable/accessible by a good number of different GUI clients.
The most popular format SourceTree supports is called git and is the focus of one of gamedev.tv’s own courses to help get you up to speed with it and Unity - I’d strongly recommend it, as systems like git are far from intuitive to learn.
The other format is called Mercurial (aka ‘Hg’) but it’s really a dying/niche breed, so other than knowing it exists, you should probably avoid it.
There are actually very few differences between the mac and windows versions of SourceTree; and for git itself there’s really no differences in capability, so even if you see some info targeting the mac it may still contain some tips you could use
A key thing about source control like git is knowing what to include and exclude, as there’s a lot of “junk” or temporary files created by tools like Unity that will clutter and confuse your actual changes to the projects. Git handles these by way of a .gitignore file for selectively ignoring files and/or folders. There are good examples of Unity .gitignore files that can be found online at gitignore.io and github.com, and you should use one of these files as early on in your “repository” (a single source code project’s storage location) as possible.
Inside your Unity projects you’ll want to check 2 key settings:
a. Visible meta files: You’ll want to enable/set this, when these files are hidden, you can lose key information about your project that will make recovering it later in the event of loss hard or impossible.
b. Force serialize asset files as text: Whilst you can store non-text files in a source code repository, no source code format is optimal at doing this as it is harder to identify partial changes to a file. So make sure they are set as text files and it will make things easier and more efficient.
Some terminology:
a. Commit: this is a point in time in your repository that contains the details of what changed. Commits contain a ‘pointer’ to their parent, so a chain of commits can follow all of your incremental changes over time.
b. Branch: a branch is just a special kind of label, but visually people usually view them as though they were ‘branches of a tree’ in their repository; as they can represent a series of commits where your code has deviated off on a tangent to try something out that may or may not work out, so gives you a way to experiment without tainting your main progress of code changes.
c. Merge: When you decide that your experiment branch was a success, you can rejoin your main branch by performing a merge, which is really just a commit with 2 parents, and a chance to check if there are any conflicts that need to be resolved.
d. Conflict: If two branches merging together have had changes to the same file, it can’t always automatically tell which changes should be kept as the correct one. So you’ll need to perform a merge conflict action that lets you intervene and make the decision as to which bits of which files should be kept, and which ones should be discarded. This can be non-trivial in a system like Unity where a lot of the files are updated/edited directly by Unity itself, but in the course I mentioned, Ben’s approach to dealing with scene differences and how to reconcile them would help.
e. Staging: There’s multiple steps to adding a file or files to a git repository; first they must be explicitly “added” to it, which is just telling git to pay attention to and index changes to the files (it doesn’t immediately add it). Next, when you have a bunch of changed files, you may not want all of them to be part of the same commit - a commit is like a specific single change in your system (even if that change may alter many files), so if your file updates would cover multiple reasons for making changes you may want to split them up into different commits. That’s where staging comes in, because only the files you select and stage will be included in the commit you’re about to make. It’s just like a strong form of “file selection” really, but it is limited to just the files your git repository is tracking.
f. Checkout: This action, when you have multiple branches or commits, is how you view the state of your repository at different points in time. So if you go off down a new experimental branch but then want to check back how things were before you did this, you’d checkout your “main” branch, which reverts your project back to that point in time. Then you can checkout your experimental branch again when you wish to continue with it, and all the differences and changes will get reapplied again.
g. Remote: In time you may want to store your repository somewhere else other than your local machine. In git terms, a copy of your repository that is held somewhere else is a “remote”. Popular systems that offer git remote services include github, gitlab, bitbucket, and so on.
Lastly, before diving in with SourceTree and git, you may want to take a look at Unity’s built in Collab features. It’s basically offering source code control much like a git/github combination, but is more directly integrated into Unity, tries to simplify some of the usage a bit, and will have documentation and education material for it over on the Unity site. Some users are happy with just this, and there’s no real right or wrong choice, just an alternative to consider especially if new to all this.
Hope some of that information will be of help. If you haven’t already installed SourceTree yet, please note that it will ask you to create/login with an Atlassian account to get started. Unless you want to though, this is only needed to get installed and started, and doesn’t require you to use that account or store any of your Unity project information there. It doesn’t make that very clear at the time though.
Hi topdog,
Thanks for the detailed information you have given. I did not mention the following so you have a better idea what kind of help i need. Please check the below out :
1 - After playing around with sourcetree, I found out how to load my project using the latest version. I have yet to find out how it connects to bit bucket or github. Yes, it did ask me to create an account in atlassian and I did but I still got no idea what I’m doing.
2 - I have spent close to a week now playing around with github desktop and I found I hardly need to make any effort as everything is computerised in the background.
3 - I already took basic free course in udemy and I already know how git, git bash and github works. I already loaded my projects using the commands before using the actual version control. So now that github desktop is computerising the gitbash work for me, I just see the results in github website.
4 - If you are serious about helping, I need detailed information on how to
a - connect to github.com. Unless you are using Windows and the latest version, this might be a problem because I am the type who prefers screenshots or at least menus so i can undertand what is happening.
b - need your help to explain where / how to enter commands to commit, push & pull. Remember that I already used gitbash so I already know the basics. I believe it’s using custom actions but I’m uncertain as another website I checked has yet to be tested.
c - Is source tree better than github desktop?
5 - I tried downloading and testing many other version control apps for Windows desktop but almost none of the others have a proper GUI, are user-friendly or are freewares so this only makes things worse.
I would be happy if you can really help me with all those above issues.
Linking your repository to a remote (such as in github or bitbucket) is a function of git; so although SourceTree has a UI dialog for adding your remote, these (and most other features of SourceTree) are not exclusive or special to it.
GitHub Desktop is not a recommended or very capable tool. It’s ok for some of the real basics, but I think up until now it still doesn’t even have the basic capability to delete a branch, for example.
All the UI clients are basically putting a shiny interface over git.
The answers to all of these are precisely what the course covers (although it starts and makes the assumption you know nothing about git to start with, it’s focused almost exclusively on how to do things using SourceTree for Windows and with some focus on how to do things “right” with a Unity project). Regarding the UI clients, yes SourceTree is better than GitHub Desktop, but once you’re familiar with SourceTree I would say that Fork is better than it. The features are nearly the same anyway because they are all shiny covers for git, but Fork’s quality and stability are much better. Regarding custom actions in SourceTree - no, at this stage you will likely never need any of those. These are for more advanced macroing of detailed git/shell commands that the client doesn’t already cover - and all the basics you mention are covered by the existing UI already.
This is true; and I would suggest sticking with SourceTree if you plan to learn because the information about it at Atlassian’s own site (and even their breakdown and explanation of git operations) and things like the courses will help to get up to speed. Once you are though, you should be comfortable switching to any UI and finding where those same features are. Fork (as I mentioned) is also free, it has the occasional “nag” screen asking for payment but they say it will remain free for use and without locked down features even if you choose not to pay.
Since you are asking for detailed screenshots and walkthroughs on SourceTree and Windows specifically (and in a Unity tagged topic), I’m instead still going to suggest you look at taking the courses regardless of what you’ve done with git and other free courses on Udemy, since it just seems to cover the exact combination that you’re looking for unless you have a more specific and targeted question to do something.
Hey topdog,
Thank you very much. I hope those courses are offered free otherwise i might have to check other beginner websites for this. I actually just succeeded getting my project from source tree to github but I still don’t quite know what I’m doing. I will put more updates here if necessary. Have a great day and I hope the divine or the admin of this website gives you a good reward for the help you offered.
As an amendment to my message, I checked the courses I had some time ago and there’s actually one with git and sourcetree already. So what I think I’ll do is I’ll check how / what they did and perhaps I can understand it better now. I will probably open a new thread since I succeeded inserting from sourcetree to github. I only hope the instructor replies to the messages I put.
You said that github desktop cannot delete branches. Are you sure? I did remove a branch and it was not difficult. May I ask if you used github desktop before? Perhaps now they have improved it so it doesn’t make that big a difference whether you use github desktop or sourcetree. Could you try github desktop if you haven’t? Then maybe you can open a new thread - something like “sourcetree vs github desktop”.