$ mkdir PROJECT.git $ cd PROJECT.git $ git init --bare
$ mkdir PROJECT $ cd PROJECT $ git clone ssh://SERVER_ADDR:SSH_PORT/PATH/TO/PROJECT.GIT . $ git config --global user.name "YOUR NAME" $ git config --global user.email "[email protected]"
- If others are working on the same repository, always pull the latest copy of the files before working on them:
$ git pull
- Create or edit your files as needed.
- When you want to archive a file, you need to COMMIT it locally on your computer. First, you should check the status of your files.
$ git status
- The git status will give you a list of files that have been added, modified, or deleted since the last COMMIT or PULL. Notice the sections these file lists are grouped by; look for "changes staged for commit", "changes NOT staged for commit", and "untracked files". Typically you want to COMMIT all modified and added files, so you must ADD the files to be COMMITted:
$ git add .
- If you want to COMMIT your deleted files too, then you must ADD the updated status of these files:
$ git add . -u
- Now all of your files should be in the "changes staged for commit" section of the git status command, so COMMIT/archive your changes locally:
$ git commit -m 'MESSAGE ABOUT CHANGES MADE'
- When you are ready to upload your COMMITs/changes to the server for your collegues to PULL down to their computer, you need to PUSH the COMMITs:
$ git push origin master
If you want to view the changes between your current copy of a file and the most recent COMMIT or PULL of the file, you can use DIFF. This will show you the changes you have made, line-by-line:
$ git diff FILENAME
If you want to revert the changes made since your last COMMIT or PULL, you can use CHECKOUT:
$ git checkout FILENAME
If you want to revert all changes made to all files in a repository since your last COMMIT or PULL, you can CHECKOUT all files:
$ git checkout .
Here is the low-down:
$ cd PROJECT $ git submodule add ssh://SERVER_ADDR:SSH_PORT/PATH/TO/PROJECT.GIT /PATH/TO/LOCAL/LOCATION/FOR/SUBMODULE $ git commit -m 'ADDED SUBMODULE TO PROJECT'
If you want to COMMIT, PUSH, PULL, etc inside the submodule, you just 'cd' into the submodule directory and perform the normal Git operations. For more info see: http://git-scm.com/book/en/Git-Tools-Submodules .