Git
Aus Claudio's Wiki
Version vom 22. Februar 2012, 14:18 Uhr von Claudio (Diskussion | Beiträge)
Inhaltsverzeichnis
Basics
Git is a Distributed Version Control System (DVCS).
Local Operations
- Working directory
- Files where you work
- Staging Area
- Staged diffs are ready to be committed
- git repository
- Committed files
Config
- System (/etc/gitconfig)
- git config --system
- Global (~/.gitconfig)
- git config --global
- Repository (%WORKINGDIRECTORY%/.git/config)
- git config --local
Ignoring files
In workingdirectory:
vim .gitignore
Basics
Clone existing Repository
git clone git://github.com/schacon/grit.git
- That creates a directory named "grit", initializes a .git directory inside it, pulls down all the data for that repository, and checks out a working copy of the latest version
git clone git://github.com/schacon/grit.git mygrit
- Creates "mygrit" directory instead of "grit"
Check Status
git status
Show log
git logoder
gitk
git log --stat
Mit Zusammenfssung der Änderungen
Formatting output
git log --pretty=oneline
git log --pretty=format:"%h - %an, %ar : %s"
git log --pretty=format:"%h %s" --graph
Limit output
git log --since=2.weeks
git log --2
git log --pretty="%h - %s" --author=gitster --since="2008-10-01" --before="2008-11-01" --no-merges
git log
git log
Stage files
A modified file under version control can be staged with the command
git addor use
git gui
git add is also used to add new files to version control.
Commit files
git commit
Remove files
git rm readme.txt
deletes the readme.txt file from working directory (file is really deleted) and from version control.
git rm --cached readme.txt
deletes the readme.txt file from version control, but not from working directory (file is still on filesystem).
Commands
git commit -m 'initial project version'