My Wiki!

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:

  1. Download snapshot.
  2. Work on project and create own snapshots.
  3. Create patches and send back with emails.

Using Git

Developer 1:

  1. Create project and a git repo (google code, github…). <code>

</code> 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"

T

his 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.

  1. Working with project. Merge project with local repo: <code> git fetch git merge </code> or <code> git pull </code>
  2. 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

Navigation
Toolbox