Difference between revisions of "Git"
m |
|||
Line 53: | Line 53: | ||
==Using a Subversion server== |
==Using a Subversion server== |
||
Getting the full project: |
Getting the full project: |
||
+ | # git clone => |
||
git-svn clone http://subversion.server.com/project -T trunk -b branches -t tags |
git-svn clone http://subversion.server.com/project -T trunk -b branches -t tags |
||
(git-gc to compress if it took a big room) |
(git-gc to compress if it took a big room) |
||
Updating the local repository according to the subversion server: |
Updating the local repository according to the subversion server: |
||
+ | # git pull => |
||
git-svn rebase |
git-svn rebase |
||
Sending the local changes to the subversion server: |
Sending the local changes to the subversion server: |
||
+ | # git push => |
||
git-svn dcommit |
git-svn dcommit |
||
+ | |||
==Ignoring some files== |
==Ignoring some files== |
||
cat > .gitignore <<EOF |
cat > .gitignore <<EOF |
Revision as of 22:25, 16 September 2008
Links
- Git on Wikipedia
- Git User Manual
- Git - SVN Crash Course Explaining Git by using SVN equivalences
- Git Magic tips compilation
- Git by example
- An introduction to git-svn for Subversion/SVK users and deserters
Install
sudo apt-get install git-svn git-doc git-gui tig
Writing to global ~/.gitconfig file:
git config --global user.name "Your Name Comes Here" git config --global user.email you@yourdomain.example.com git config --global color.diff auto git config --global color.status auto git config --global color.branch auto
Creating a .git in the current (project) directory:
git init
Basic usage
Schedule a file for committing
git add <file>
Committing
git commit
Note that a modified file must be explicitly added every time, unless you use
git commit -a
File renaming is implicit, so you don't have to take care, just rename your files if you want
Initial project
Add manually files/directories e.g. with
git init git add * git commit
Copying existing project
Clone an existing Git repository into a to-be-created target directory:
git clone /path/to/other/repository target
Remote repositories can also be accessed with paths like
ssh://login@host/path/to/repository git://git.software.org/trunk http://git.software.org/trunk
Later to update the local repository according to the remote repository:
git pull
Symmetrically the remote repository owner could also get the changes we've done locally if she does:
git pull /path/to/our/target
Or we could send them ourselves if we've write access on the remote:
git push
BTW the remote can create a shortcut to us to not have to provide our full path everytime
git remote add ourshortcut /path/to/our/target
And now use directly
git remote show ourshortcut git pull ourshortcut
Note that git pull ourshortcut ==
git fetch ourshortcut git merge ourshortcut/master
Using a Subversion server
Getting the full project:
# git clone => git-svn clone http://subversion.server.com/project -T trunk -b branches -t tags (git-gc to compress if it took a big room)
Updating the local repository according to the subversion server:
# git pull => git-svn rebase
Sending the local changes to the subversion server:
# git push => git-svn dcommit
Ignoring some files
cat > .gitignore <<EOF *.pyc *~ EOF git add .gitignore
etckeeper
TODO