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