====== Git by example ====== ===== Description of project sharing without versioning ===== Developer 1: 1. Create project. 2. Tracking project snapshots. Each snapshot is stored in a directory e.g: project_yyyymmdd. 3. Share a snapshot (working version) by posting a tar.gz on website. Developer 2: 4. Download snapshot. 5. Work on project and create own snapshots. 6. Create patches and send back with emails. ===== Using Git ===== Developer 1: 1. Create project and a git repo (google code, github...). 2. Versioning. * Add new files to project git add . This will add current folder recursively. If one of the sub-folder contains .git, this folder will be add to repo as submodule. More about submodule <...>. * Commit a new version. git commit -a -m "message" This will commit all changes to local git manifest. 3. Share project. Push project back to central repository. git push origin master This will copy working branch to central repo. To get info about the alias use: git remote -v origin https://thuydang.de@code.google.com/p/tdinfra/ (fetch) origin https://thuydang.de@code.google.com/p/tdinfra/ (push) To see all branches: git branch *master other_branch 'master' is the working branch. The push command above will push the master branch to google code. Developer 2: 4. Download project git clone ... The project must be downloaded as a whole. No downloading of single sub folder possible. 5. Working with project. Merge project with local repo: git fetch git merge or git pull 6. Push project to central repo. ===== Working with git ===== ==== Undelete ==== to see the deleted files so they can be copied later: git ls-files -d undelete file: git checkout -- /path/to/file ===== references ===== * abc *