Git Gui Guide¶
- Git Gui Guide
Welcome to the Git Gui guide.
First of all it is important to make you positive about git.
There is a transition phase and it has some downsides, yet we are working hard to get these out of the way too.
Pros about git¶
- No messing with SVN folders (no .svn folder in each folder). All the files of the local repository are in one .git folder in the top most level.
- You can just remove or rename files via explorer (no TSVN rename/delete extra command needed) (see notes below).
- Upload and download takes less time due to very good compression.
- Overall very fast command execution (better in performance).
- You commit to your local repository first. This means you can commit ASAP without normal wait times. You do the upload to the server of several commits just once in one go.
- Git Bash gives you the option to work in a Linux cmd line. Allows some nice advanced use (mass delete / rename etc).
- Tools: Git Gui has most of the needed git command available easily via key shortcuts. The app is fast and the UI is fine.
Problems we still need to solve¶
- Hard to mass revert local changes: You want to drop your changes and go back to the last unmodified version for many files / a folder subtree.
- Hard to get locally mass deleted files back: You delete a bigger number of files by mistake and want them back.
- Wit many files or a big repository git seems to be slow to compile all local changes. The reason is as git always does check the whole repository and not only the folder (and its subfolders) you are currently in.
- Not as simple to get a diff on a file like with 'TSVN: click file, RMB, diff'.
Setup local repository¶
Alright let's get started.
We will sort out the standard workflow you will work with git and the different naming.
1) First you need to sort out the required tools and the putty key. See Source Code Management.
2) Next you need to download the git file repository of your project.
URL normally looks like this:
You need to connect to the URL once with putty to sort some git bug and get the server's key.
To create the git repository on your pc, we will use Git Bash (command line) as this seems most simple.
1) Go in the explorer to the folder you want to put the stuff in.
2) Click RMB on that folder.
3) Select Git Bash.
4) Enter git clone URL. Clone equals to SVN: checkout.
git clone git.dev-heaven.net:ace-mod.git
Standard day-to-day workflow¶
Get the latest files from the server.¶
To my knowledge you cannot use Git Gui for this operation, so again Git Bash is our choice.
1) In the explorer click RMB on any folder inside the git repository. x
2) Select *Git Bash.
3) Enter git pull. Pull equals to SVN: update.
x): Unlike with SVN, the level do not matter for this command. With a standard git repository without submodules, you can only update the complete repository and not only a subtree of folders and its files.
Sometimes you have to specific the branch you want to download. Yet normally you stay on the master and there is no need to add it.
git pull origin master
Uploading your changes to the server.¶
In SVN this is only one command: SVN: commit. For git this is split into three phases. This is a bit confusing at first, yet it is simple and does have it advantages:
- git stage file(s)
- git commit file(s)
- git push
This means you mark files ready for the commit command. This allows some advanced use, yet for our standards these are not important.
Let's launch Git Gui now finally. Again you need to select one folder inside your repository - which one doesn't matter.
1) In the explorer click RMB on any folder inside the git repository.
2) Select Git Gui.
1) The button the in the lower center, called rescan, or F5 will check your repository for modifications.
2) In the top left box, called unstaged changes, you will see all the files you have modified in the repository.
Use CTRL or shift + mouse click to select multiple files in there.
3) CTRL T will mark the selected set as staged and will put them in into the lower left box, called stages changes.
4) Now the staged files should be in the lower left corner. If you want to unstage a (set of) file(s), select commit->unstage from commit from the menu bar.
You can now commit the staged files to your local repository.
In other words you can always add a change to your local repository first.
This is useful when not having an Internet connection or to create logic atomic commits as often as possible.
In the lower right box, called commit message, you have to define the commit comment. Use the standard syntax according to your project like
~ Added: new feature X. Players can now self kill by pressing ENTER.
The key shortcut to to the commit is ALT ENTER or press the commit button in the bottom center.
Once you want to upload all your commits to the project server somewhere in the Internet, select git push. Again button in the lower center or CTRL P.
~ What is sign off.
~ Handling of conflicts
~ Reverting changes / getting back deleted files.
~ Simple file diff via explorer
~ How to check the history
~ Merge http://dev-heaven.net/boards/1/topics/show/15