-
Notifications
You must be signed in to change notification settings - Fork 26
Git User Guide
This is a reference guide on relevant git commands to use and maintain this repository. For more extended reference you may want to visit the following public tutorials:
Sign up in github -> Edit your profile -> SSH Keys -> Add SSH Key (Upload your public SSH key).
You can create repositories in your own account, or in an organization that you are a member of. In this case we have created the ACS repository under ACS-Community organization.
To clone a repository:
mac - ~ $ git clone username@host:/path/to/repository
To clone the ACS repository:
mac - ~ $ git clone [email protected]:ACS-Community/ACS.git
This command will create a folder in your local file system with the ACS repository.
You can propose changes (add it to the Index) using
mac - ~ $ git add <filename>
or
mac - ~ $ git add *
or
mac - ~ $ git add .
This is the first step in the basic git workflow. To actually commit these changes:
mac - ~ $ git commit -m "Commit message"
Now the file is committed to the HEAD, but not in the remote repository yet.
To send those changes to your remote repository:
mac - ~ $ git push origin master
Change master to whatever branch you want to push your changes to.
To update your local repository to the newest commit:
mac - ~ $ git pull
It's recommended to create tags for software releases. For example this line will show you the existing tags in your repository:
mac - ~ $ git tag
To create a new tag:
mac - ~ $ git tag -a v0.1 -m 'Initial version'
Switch the local copy to a specific tag:
mac - ~ $ git checkout tags/<tag_name>
Github provides a easy way to create tags & releases: after commit & push the changes, you can create new tags & releases using the web interface: Creating Releases.
Git has something called submodule support. This allows you to specify one or more other git repositories within another (like svn:externals):
mac - ~ $ git submodule add [email protected]:other_project.git
mac - ~ $ git commit .gitmodules other_project -m "Added other_project submodule"
mac - ~ $ git push
Git doesn’t automatically fetch all your submodules, to add to your local directory:
mac - ~ $ git submodule init [email protected]:jantogni/testing.git
mac - ~ $ git submodule init
mac - ~ $ git submodule update
To git clone
including submodules directly:
mac - ~ $ git clone --recursive [email protected]:jantogni/testing.git
To pull the latest version of each submodules:
mac - ~ $ git submodule foreach git pull origin master
mac - ~ $ git commit -am "Pulled down update to ..."
Git and SVN repository can interact using git svn
. This utility contains several commands allowing bidirectional operation between Subversion and Git.
The tutorial to setup a git repository from another SVN repository is here
In summary, the following is the workflow used in a git svn repository:
- Clone the svn repository using
git svn clone <svn_respository_address>
- Work locally on the changes you want to do
- Synchronize back changes from the remote svn repository using
git svn rebase
. There may be conflicts, resolve them according to git guidelines - Push the changes done locally to the remote svn repository using
git svn dcommit
. This command change your commit data, adding extra info to the commit message changing the SHA1 checksum of the commit.