]> TLD Linux GIT Repositories - TLD.git/blob - git-howto.txt
1a52c603b6c62cd988dbeb0ce97823aa46bc67e7
[TLD.git] / git-howto.txt
1 This little howto is about the Git repository used by Titanium Linux.
2 You will find here examples of the most common git commands.
3
4 Ready? Let's start (you must have RW access to TLD git repositories).
5
6 Table Of Content:
7
8 1. How do I commit a new .spec file or package to the repository?
9    a) Clone an empty repository (note: it will be automatically created on server
10       side.)
11    b) Set your local Email address
12    c) Put your files into the repository and add them locally
13    d) Push your changes to the server
14 2. Crap, I've checked out a repository, forgot to change the local e-mail
15    address and commited my changes. Now I can't push them to the server.
16    What can I do?
17 3. My new repository didn't show up on the web.
18 4. I've deleted some files in my cloned repo. I'm doing git pull, but they
19    do not reappear.
20 5. How can I add a description to a new repository?
21 6. SPECS: What is obsolete now that we have GIT?
22
23 ==============================================================================
24 1. How do I commit a new .spec file or package to the repository?
25
26 a) Clone an empty repository (note: it will be automatically created on server
27    side.)
28
29 git clone git@git.tld-linux.org:packages/your_new_package
30
31 b) Set your local Email address
32
33 cd your_new_package
34 git config --local user.email your_git_login@tld-linux.org
35
36 This step allows you to later push your changes to the server. If you skip
37 this step, your push will fail due to a server side hook.
38
39 c) Put your files into the repository and add them locally
40
41 git add file1 file2 files*
42 git commit
43
44 d) Push your changes to the server
45
46 If you push your changes for the first time of the repositorys "life", you'll
47 need to add the origin to it.
48
49 git push origin master
50
51 After that you'll be fine by doing just:
52
53 git push
54
55 NOTE:
56
57 It is possible to shorten these commands ex. git add and git commit can be put
58 together into: git commit -a. You can commit several times into your local
59 repository before pushing all changes to server. You don't need to push each
60 time you commit, but feel free to do so if you want :-)
61
62 ==============================================================================
63 2. Crap, I've checked out a repository, forgot to change the local e-mail
64 address and commited my changes. Now I can't push them to the server.
65 What can I do?
66
67 This is very unfortunate. AFAIK you've got only 2 options.
68
69 a) Delete your commit. This means all of your changes will be lost, but you
70 can store them elsewhere for the time being, right?
71
72 To do this (after you backed up your changes) type:
73
74 git reset --hard HEAD~1
75
76 the HEAD~1 option tells git to go 1 commit back in the history. Now set your
77 local e-mail address, put back your changes and commit again. Push should now
78 work as expected.
79
80 b) The second way is to remove locally your repository and re-clone it. Then
81 put back your changes to it, commit and push.
82
83 ==============================================================================
84 3. My new repository didn't show up on the web.
85
86 Repository "packages" are checked every 15 minutes for new subrepositories by
87 a cron job. If found, they're added to the web. If for some reason cron job
88 fails, ask one of the git admins to run and/or fix this script:
89
90 ~git/scripts/packages_enable_gitweb.sh
91
92 Top level repositores have to be added manually to gitweb. Ask one of the git
93 admins to do the following:
94
95 ssh your_login@kraz.tld-linux.org
96 sudo su - git
97 cd ~/repositories/repo_name.git
98 touch gitweb-export-ok
99
100 ==============================================================================
101 4. I've deleted some files in my cloned repo. I'm doing git pull, but they
102 do not reappear.
103
104 Please do the following in your cloned repo to restore deleted files:
105
106 git checkout some.file
107
108 To restore all your deleted files do:
109
110 git ls-files -d | xargs git checkout --
111
112 ==============================================================================
113 5. How can I add a description to a new repository?
114
115 Do the following:
116
117 ssh git@git.tld-linux.org setdesc packages/some_package "Some description"
118
119 ==============================================================================
120 6. SPECS: What is obsolete now that we have GIT?
121
122 Now that we use GIT for our own .spec files and projects, there're some things
123 we do no longer need.
124
125 a) Remove "# $Revision:" lines on top of a .spec file
126 b) Remove the whole changelog from the bottom of a .spec file
127 c) Remove "%define date    %(echo `LC_ALL="C" date +"%a %b %d %Y"`)"
128 d) Remove feedback stuff and all PLD related links
129
130 Why all that removing?
131 There're a couple of reasons why we don't want to keep these things in our 
132 specs.
133 Most of them are strictly CVS related, like the Revision stuff. We don't need
134 to artificially increase the size of our .spec files by having the whole 
135 changelog included in them. Use "git log", with all its sophisticated options,
136 to visualise changes, make statistics etc.