1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
[[!toc ]]
## Getting the sources
ooo-build sources are stored in [[git|http://git-scm.com/]]. To clone the latest version of ooo-build, please use:
[[!format txt """
git clone git://anongit.freedesktop.org/git/ooo-build/ooo-build
"""]]
Registered developers should use the following command to enable writing to the repository:
[[!format txt """
git clone ssh://[username@]git.freedesktop.org/git/ooo-build/ooo-build
"""]]
If you [[asked for your account|Software/ooo-build/AccountRequestCheatSheet]], but did not get one yet, just clone from the anonymous repository, you can commit and update (`git pull -r`) immediately, and push the changes later when you have the read/write access. You can also [[send the changes by mail|Software/ooo-build/Contributing]]. To change your anonymous clone into a read/write (after you got the write access), change the URL in .git/config from the anonymous URL to the read/write.
To learn how to build your fresh ooo-build clone, continue with the [[BuildingIt|Software/ooo-build/BuildingIt]] pages.
## Basic instructions
Please check our **[[SVN to git cheat sheet|Software/ooo-build/SVNToGitCheatSheet]]** for quick reference. You might be also interested in [[git/hg cheat sheet|http://mercurial.selenic.com/wiki/GitConcepts#Command_equivalence_table]] if you are more a Mercurial person, or if you want to up-stream something.
## Getting a particular branch
When you have cloned the repository, you can switch to any branch you need. The bleeding edge development happens in _master_, which is what you get when you clone the repository. To switch eg. to branch _ooo-build-3-2-1_, do:
[[!format txt """
git checkout -b ooo-build-3-2-1 origin/ooo-build-3-2-1
"""]]
This exactly means "please create a local branch ooo-build-3-2-1 that tracks what's happening in the remote branch ooo-build-3-2-1". You can get a list of all the available remote branches using _git branch -r_.
Once you have created the branch(es), you can switch between them using _git checkout_:
[[!format txt """
git checkout master
git checkout ooo-build-3-2-1
"""]]
_Note: You might want to keep the older ooo-build branches in separate locations. When you have cloned ooo-build master to eg. ~/ooo-build, you can use the --reference feature of git clone to save bandwidth:_
[[!format txt """
git clone --reference ~/ooo-build \
ssh://[username@]git.freedesktop.org/git/ooo-build/ooo-build ooo-build-3-2-1
cd ooo-build-3-2-1
git checkout -b ooo-build-3-2-1 origin/ooo-build-3-2-1
"""]]
_We recommend you to have the branch you are interested in as the only branch there:_
[[!format txt """
# remove the master branch in this repository, we are interested only in ooo-build-3-2-1
git branch -D master
"""]]
## Getting a particular tag
To switch your local repository to the given tag, use the following command:
[[!format txt """
# let's say we want the tag OOO_BUILD_3_0_99_3
git checkout -b tag-OOO_BUILD_3_0_99_3 OOO_BUILD_3_0_99_3
"""]]
This exactly means "please create a local branch tag-OOO_BUILD_3_0_99_3 that shows the state of the sources when the tag OOO_BUILD_3_0_99_3 was created". For the operations like diff, log, etc. you don't have to create the branch; just directly do
[[!format txt """
git log OOO_BUILD_3_0_99_3
git diff OOO_BUILD_3_0_99_3 master
"""]]
The tags are created for released sources, branches or some specific commits. To list them all, use:
[[!format txt """
# ensure that you have all the tags from the remote repository
git pull -t
# show the tags
git tag
"""]]
## Getting the latest updates
We use the same git workflow as described in the [[common freedesktop.org git instructions|Infrastructure/git/Developers]]. The reasoning is simple - using just the _git pull_ (without the _-r_) tends to create too many unnecessary 'merge' commits when there are more people working on one repository - and this is what we want to avoid.
So, to get the updates, use
[[!format txt """
git pull -r
"""]]
Please, **do not forget the _-r_ !** - _-r_ means that instead of merging, _git pull_ rebases your local changes against the changes from the remote repository. See also the [[Pushing the changes|Software/ooo-build/GettingIt]] section.
_Note: Using rebase might be dangerous, and can lead to a situation when you seemingly lose a commit. Don't worry, nothing is lost with git - after the finished git pull -r do the following:_
[[!format txt """
# let git search for the lost commits
git fsck --lost-found
# show them all, together with the patches
git show `cat .git/lost-found/commit/*`
# find the commit ID in the git show, and create a temporary branch
git checkout -b tmpbranch the_ID_you_just_found
# now you have the commit in tmpbranch, and you can do what you need
# (eg. another rebase, or something)
"""]]
## More info
* [[I have the ooo-build sources. What next?|Software/ooo-build/]]
* [[git home page|http://git-scm.com/]]
* [[ooo-build SVN to git cheat sheet|Software/ooo-build/SVNToGitCheatSheet]]
* [[freedesktop.org git instructions|Infrastructure/git/Developers]]
* [[freedesktop.org git repo administration|Infrastructure/git/RepositoryAdmin]] - personal repositories, etc.
* [[Pro Git|http://progit.org/book/]] - the Git book
|