GitCentralizedWorkflow
Quick and dirty guide to use Git with a centralized workflow.
Initializing the "central" repository
This should be done just once, if the centralized copy already exists, you can skip this part. ToDo
Getting a copy of the repository
The first thing that a typical user wants to do is to get a local clone of the repository:
git clone ssh://user@host/path/to/repo.git localDirectory
This copies the whole repository to a special directory inside the local directory. Moreover, it checks out a working copy of the project in the local directory, i.e., you will have the files of the project in the local directory.
Work with the repository
The usual work routine should be as follows.
- Fetch the latest versions of files from the central repository and merge them with the local versions:
git pull --rebase origin master
- Edit the local files
- Commit the new version of the files to the local copy of the repository
git commit -a
- Push your commit(s) to the centralized repository
git push origin master
If somebody commits changes to the central repository that conflict with the changes you made, when you try to push your changes you get an error. At that point, you can pull the changed version from the server, then run "git status" to see what is happening and then solve the conflict (not sure how that is done, at the moment)
Moreover, you might want to add some new files to the repository.
- Add some new files to the set of the tracked files (they will be added to the repository the first time you do a commit)
git add alpha.cpp beta.cpp
Useful links
Git tutorial on centralized workflow: http://www.atlassian.com/git/workflows#!workflow-centralized Pro Git book: http://git-scm.com/book