]> TLD Linux GIT Repositories - TLD.git/blob - git-howto.txt
- don't forget about email alias
[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
22 ==============================================================================
23 1. How do I commit a new .spec file or package to the repository?
24
25 a) Clone an empty repository (note: it will be automatically created on server
26    side.)
27
28 git clone git@git.tld-linux.org:packages/your_new_package
29
30 b) Set your local Email address
31
32 cd your_new_package
33 git config --local user.email your_git_login@tld-linux.org
34
35 This step allows you to later push your changes to the server. If you skip
36 this step, your push will fail due to a server side hook.
37
38 c) Put your files into the repository and add them locally
39
40 git add file1 file2 files*
41 git commit
42
43 d) Push your changes to the server
44
45 If you push your changes for the first time of the repositorys "life", you'll
46 need to add the origin to it.
47
48 git push origin master
49
50 After that you'll be fine by doing just:
51
52 git push
53
54 NOTE:
55
56 It is possible to shorten these commands ex. git add and git commit can be put
57 together into: git commit -a. You can commit several times into your local
58 repository before pushing all changes to server. You don't need to push each
59 time you commit, but feel free to do so if you want :-)
60
61 ==============================================================================
62 2. Crap, I've checked out a repository, forgot to change the local e-mail
63 address and commited my changes. Now I can't push them to the server.
64 What can I do?
65
66 This is very unfortunate. AFAIK you've got only 2 options.
67
68 a) Delete your commit. This means all of your changes will be lost, but you
69 can store them elsewhere for the time being, right?
70
71 To do this (after you backed up your changes) type:
72
73 git reset --hard HEAD~1
74
75 the HEAD~1 option tells git to go 1 commit back in the history. Now set your
76 local e-mail address, put back your changes and commit again. Push should now
77 work as expected.
78
79 b) The second way is to remove locally your repository and re-clone it. Then
80 put back your changes to it, commit and push.
81
82 ==============================================================================
83 3. My new repository didn't show up on the web.
84
85 Repository "packages" are checked every 15 minutes for new subrepositories by
86 a cron job. If found, they're added to the web. If for some reason cron job
87 fails, ask one of the git admins to run and/or fix this script:
88
89 ~git/scripts/packages_enable_gitweb.sh
90
91 Top level repositores have to be added manually to gitweb. Ask one of the git
92 admins to do the following:
93
94 ssh your_login@kraz.tld-linux.org
95 sudo su - git
96 cd ~/repositories/repo_name.git
97 touch gitweb-export-ok
98
99 ==============================================================================
100 4. I've deleted some files in my cloned repo. I'm doing git pull, but they
101 do not reappear.
102
103 Please do the following in your cloned repo to restore deleted files:
104
105 git checkout some.file
106
107 To restore all your deleted files do:
108
109 git ls-files -d | xargs git checkout --
110
111 ==============================================================================
112 5. How can I add a description to a new repository?
113
114 Do the following:
115
116 ssh git@git.tld-linux.org setdesc packages/some_package "Some description"
117