Git GUI Guide

Version 21 (kju, 04/02/2009 17:53)

1 1 kju
h1. Git Gui Guide
2 1 kju
3 2 kju
{{>toc}}
4 1 kju
5 2 kju
Welcome to the *Git Gui* guide. 
6 2 kju
7 1 kju
8 1 kju
h2. Setup local repository
9 1 kju
10 1 kju
Alright let's get started.
11 13 kju
We will sort out the standard workflow and the different naming of git,
12 15 kju
to make yourself somewhat familiar with the new tool set.
13 1 kju
14 15 kju
15 15 kju
h3. Make sure you are ready
16 15 kju
17 15 kju
# [[Git#Installation-of-the-Core-Client-MSysGit:Required tools: MSysGit]] 
18 15 kju
# [[SSH-Keyset:SSH key]] created, loaded by pageant and sent to "kju":/account/show/4.
19 15 kju
20 15 kju
21 15 kju
h3. Get repository
22 15 kju
23 15 kju
Next you need to *download the git file repository of your project*.
24 6 kju
25 1 kju
To create the git repository on your pc, we will use *Git Bash* (command line) as this seems most simple.
26 1 kju
27 13 kju
*Important*: Make sure you ssh-key is loaded via pageant. See [[SSH-Keyset]] in case of trouble.
28 3 kju
29 13 kju
# Go in the explorer to the folder you want to put the stuff in.
30 13 kju
# Click RMB on that folder.
31 13 kju
# Select *Git Bash*.
32 16 kju
# Enter *git clone URL*:
33 13 kju
@git clone git@git.dev-heaven.net:REPOSITORYNAME.git@
34 1 kju
35 13 kju
You will get the repository name from the project manager or at times in the projects wiki.
36 1 kju
37 16 kju
Note for SVN users: *Clone* equals to *SVN: checkout*.
38 16 kju
39 13 kju
Wait for the process to finish. This can take quite some time. _Patience_!
40 13 kju
41 1 kju
!git_bash_clone.jpg!
42 1 kju
43 1 kju
44 1 kju
45 10 kju
h2. Standard day-to-day workflow
46 12 kju
47 12 kju
48 5 kju
h3. Get the latest files from the server.
49 1 kju
50 1 kju
To my knowledge you cannot use *Git Gui* for this operation, so again *Git Bash* is our choice.
51 13 kju
52 1 kju
1) In the explorer click RMB on any folder inside the git repository.
53 1 kju
2) Select *Git Bash*.
54 16 kju
3) Enter *git pull*.
55 1 kju
56 16 kju
Note for SVN users: *Pull* equals to *SVN: update*.
57 16 kju
58 13 kju
*Note*: Unlike with SVN, the level do not matter for this command. 
59 13 kju
With a standard git repository without *submodules*, you can *only update the complete repository*
60 13 kju
and *not only a subtree of folders and its files*.
61 1 kju
62 1 kju
<pre>
63 1 kju
git pull
64 1 kju
</pre>
65 1 kju
66 17 kju
Sometimes you have to specify the branch you want to download.
67 13 kju
Yet normally you stay on the master and there is no need to add it.
68 1 kju
69 6 kju
@git pull origin master@
70 1 kju
71 1 kju
!git_bash_pull.jpg!
72 1 kju
73 1 kju
74 1 kju
h3. Uploading your changes to the server.
75 1 kju
76 16 kju
In SVN there is only one command: *SVN: commit*. For git this is split into three phases. 
77 13 kju
This is a bit confusing at first, yet it is simple and does have it advantages:
78 12 kju
79 1 kju
* git stage file(s)
80 1 kju
* git commit file(s)
81 1 kju
* git push
82 1 kju
83 1 kju
!git_gui.jpg!
84 1 kju
85 13 kju
86 1 kju
h4. Stage
87 3 kju
88 13 kju
This means you mark files ready for the commit command.
89 13 kju
This allows some advanced use, yet for our standards these are not important.
90 1 kju
91 13 kju
Let's launch *Git Gui* now finally.
92 13 kju
Again you need to select one folder inside your repository - which one doesn't matter.
93 1 kju
94 1 kju
95 14 kju
# In the explorer click RMB on any folder inside the git repository.
96 14 kju
# Select *Git Gui*.
97 1 kju
98 18 kju
!open_git_gui.png!
99 18 kju
100 1 kju
101 21 kju
I) The button the in the lower center, called *Rescan*,
102 14 kju
   or *F5* will check your repository for modifications.
103 13 kju
104 21 kju
II) In the top left box, called *Unstaged Changes*,
105 14 kju
    you will see all the files you have modified in the repository.
106 14 kju
    Use *CTRL* or *shift* + *mouse click* to select multiple files in there.
107 1 kju
108 14 kju
III) *CTRL T* will mark the selected set as staged and will put 
109 21 kju
     them in into the lower left box, called *Staged Changes*.
110 1 kju
111 14 kju
IV) Now the staged files should be in the lower left corner.
112 14 kju
    If you want to *unstage* a (set of) file(s), 
113 21 kju
    select *Commit->Unstage from commit* from the menu bar.
114 14 kju
115 14 kju
116 1 kju
h4. Commit
117 13 kju
118 21 kju
You can now *Ccmmit* the staged files to your local repository.
119 14 kju
In other words you can always add a change to your local repository first.
120 14 kju
This is useful when not having an Internet connection or 
121 14 kju
to create logic atomic commits as often as possible.
122 1 kju
123 14 kju
In the lower right box, called *commit message*, you have to define the *commit comment*. 
124 14 kju
Use the standard syntax according to your project like
125 1 kju
126 1 kju
> ~ Added: new feature X. Players can now self kill by pressing ENTER.
127 13 kju
128 21 kju
The key shortcut to to the commit is *CTRL Enter* or press the *Commit* button in the bottom center.
129 1 kju
130 1 kju
131 1 kju
h4. Push
132 1 kju
133 1 kju
Once you want to upload all your commits to the project server somewhere in the Internet,
134 21 kju
you call *git push*. Again press the *Push* button in the lower center or *CTRL P*.
135 1 kju
136 1 kju
!git_push.jpg!
137 1 kju
138 1 kju
139 21 kju
h3. Reverting Uncommitted Changes
140 1 kju
141 21 kju
At times you have modified a (set of) files on your computer and you want to discard those changes.
142 21 kju
143 21 kju
# Launch *Git Gui*.
144 21 kju
# Select the (set of) files in either the *Unstaged Changes* or *Staged Changes* list.
145 21 kju
# Apply *Revert Changes* found in the menu bar in the *commit* list.
146 21 kju
147 21 kju
148 21 kju
h3. Rename files or folders.
149 21 kju
150 21 kju
Pretty simple with git.
151 21 kju
You can rename the file(s) or folder(s) with your explorer and git will be able to link the removal
152 21 kju
with the addition automatically and maintain the history.
153 21 kju
154 21 kju
155 21 kju
h3. Move files or folders
156 21 kju
157 21 kju
TODO
158 21 kju
159 21 kju
160 21 kju
h3. Follow project progress
161 21 kju
162 21 kju
First select the "project space":/projects you are interested first.
163 21 kju
164 21 kju
The "Activity":/projects/activity/heaven view of git shows all pushed changes to the remote repository, along with other information.
165 21 kju
By clicking on "Changesets":/projects/activity/heaven?show_changesets=1 only the code changes will be shown.
166 21 kju
Click on a "specific revision":/repositories/revision/19/2b4da3bad17a99e51bac60647d191a97297a01b8 to read the full commit message and have all modified files listed.
167 21 kju
You can even check the "diffs of all":/repositories/diff/sixarma-buildsuite?rev=2b4da3bad17a99e51bac60647d191a97297a01b8 or "each":/repositories/diff/sixarma-buildsuite/app/models/addonfolder.rb?rev=2b4da3bad17a99e51bac60647d191a97297a01b8 modified files of revision.
168 21 kju
169 21 kju
170 21 kju
h3. Browse repository or download single files
171 21 kju
172 21 kju
173 1 kju
h2. TODO
174 1 kju
175 14 kju
~ What is sign off.
176 1 kju
~ Handling of conflicts.
177 14 kju
~ Reverting changes / getting back deleted files.
178 14 kju
~ Simple file diff via explorer.
179 7 kju
~ How to check the history.
180 14 kju
~ Merge http://dev-heaven.net/boards/1/topics/show/15