From 296ddd1ca0fe051ae27a6712a844146ad1c41643 Mon Sep 17 00:00:00 2001 From: Marcin Krol Date: Tue, 24 Jan 2012 23:30:47 +0100 Subject: [PATCH] - moved to wiki --- git-howto.txt | 199 -------------------------------------------------- 1 file changed, 199 deletions(-) delete mode 100644 git-howto.txt diff --git a/git-howto.txt b/git-howto.txt deleted file mode 100644 index e238ee4..0000000 --- a/git-howto.txt +++ /dev/null @@ -1,199 +0,0 @@ -This little howto is about the Git repository used by Titanium Linux. -You will find here examples of the most common git commands. - -Ready? Let's start (you must have RW access to TLD git repositories). - -Table Of Content: -1. How do I prepare git to work? - a) Install git-core - b) Configure git globally - c) Configure ssh environment to work with git -2. How do I commit a new .spec file or package to the repository? - a) Clone an empty repository (note: it will be automatically created on server - side.) - b) Set your local Email address - c) Put your files into the repository and add them locally - d) Push your changes to the server -3. Crap, I've checked out a repository, forgot to change the local e-mail - address and commited my changes. Now I can't push them to the server. - What can I do? -4. My new repository didn't show up on the web. -5. I've deleted some files in my cloned repo. I'm doing git pull, but they - do not reappear. -6. How can I add a description to a new repository? -7. SPECS: What is obsolete now that we have GIT? - -============================================================================== -1. How do I prepare git to work? - -a) Install git-core - -Just install git-core package via poldek: - -poldek -install git-core - -b) Configure git globally - -To be able to work with git on TLD repository you will need to set up few -things in git config: - -- your e-mail address which consists of your git login and tld-linux.org domain -- your username, which should consist of your name and surename - -To do so, type: - -git config --global user.email "your_git_login@tld-linux.org" -git config --global user.name "John Doe" - -Replace "your_git_login" and "John Doe" accordingly. - -Above commands will create ~/.gitconfig file with proper settings. - -c) Configure ssh environment to work with git - -If you plan to use non default ssh key pair, it's better to put some info about -it to your default .ssh/config file. Edit your local Host alias and key path in -sample below: - -Host git.tld-linux.org - User git - Hostname git.tld-linux.org - PreferredAuthentications publickey - IdentityFile /home/users/YOURUSER/.ssh/YOUR_KEY_FILE - -To test if ssh works, do the: - -ssh -T git.tld-linux.org - -you should get similar answer: - -hello USER, the gitolite version here is x.y.z -the gitolite config gives you the following access: - R W TLD - (...) - -============================================================================== -2. How do I commit a new .spec file or package to the repository? - -a) Clone an empty repository (note: it will be automatically created on server - side.) - -git clone git@git.tld-linux.org:packages/your_new_package - -b) Set your local Email address - -This step is optional if your git is configured globally (see point 1 of this HOWTO). - -cd your_new_package -git config --local user.email your_git_login@tld-linux.org - -This step allows you to later push your changes to the server. If you skip -this step, your push will fail due to a server side hook. - -c) Put your files into the repository and add them locally - -git add file1 file2 files* -git commit - -d) Push your changes to the server - -If you push your changes for the first time of the repositorys "life", you'll -need to add the origin to it. - -git push origin master - -After that you'll be fine by doing just: - -git push - -NOTE: - -It is possible to shorten these commands ex. git add and git commit can be put -together into: git commit -a. You can commit several times into your local -repository before pushing all changes to server. You don't need to push each -time you commit, but feel free to do so if you want :-) - -============================================================================== -3. Crap, I've checked out a repository, forgot to change the local e-mail -address and commited my changes. Now I can't push them to the server. -What can I do? - -This is very unfortunate. AFAIK you've got only 2 options. - -a) Delete your commit. This means all of your changes will be lost, but you -can store them elsewhere for the time being, right? - -To do this (after you backed up your changes) type: - -git reset --hard HEAD~1 - -the HEAD~1 option tells git to go 1 commit back in the history. Now set your -local e-mail address, put back your changes and commit again. Push should now -work as expected. - -b) The second way is to remove locally your repository and re-clone it. Then -put back your changes to it, commit and push. - -============================================================================== -4. My new repository didn't show up on the web. - -Repository "packages" are checked every 15 minutes for new subrepositories by -a cron job. If found, they're added to the web. If for some reason cron job -fails, ask one of the git admins to run and/or fix this script: - -~git/scripts/packages_enable_gitweb.sh - -Top level repositores have to be added manually to gitweb. Ask one of the git -admins to do the following: - -ssh your_login@kraz.tld-linux.org -sudo su - git -cd ~/repositories/repo_name.git -touch gitweb-export-ok - -============================================================================== -5. I've deleted some files in my cloned repo. I'm doing git pull, but they -do not reappear. - -Please do the following in your cloned repo to restore deleted files: - -git checkout some.file - -To restore all your deleted files do: - -git ls-files -d | xargs git checkout -- - -============================================================================== -6. How can I add a description to a new repository? - -Do the following: - -echo "Some description" |ssh git@git.tld-linux.org setdesc packages/some_package - -Ex. - -$ echo "kernel-desktop, a linux version optimised for the desktop" |ssh git@git.tld-linux.org setdesc packages/kernel-desktop -New description is: -kernel-desktop, a linux version optimised for the desktop -$ - -============================================================================== -7. SPECS: What is obsolete now that we have GIT? - -Now that we use GIT for our own .spec files and projects, there're some things -we do no longer need. - -a) Remove "# $Revision:" lines on top of a .spec file -b) Remove the whole changelog from the bottom of a .spec file -c) Remove "%define date %(echo `LC_ALL="C" date +"%a %b %d %Y"`)" -d) Remove feedback stuff and all PLD related links -e) Remove all the conditions for pld_release (%if "%{pld_release}" == "ti" ect.) - -Why all that removing? -There're a couple of reasons why we don't want to keep these things in our -specs. -Most of them are strictly CVS related, like the Revision stuff. We don't need -to artificially increase the size of our .spec files by having the whole -changelog included in them. Use "git log", with all its sophisticated options, -to visualise changes, make statistics etc. -- 2.46.0