-
Notifications
You must be signed in to change notification settings - Fork 2
Working with git
All operations in Git are local, meaning that Git's repository and all changes are kept in your local file system. When you check-in, you're doing so locally. When you switch branches, that's local. When you merge, it's local. In order to make those changes visible in the remote repository, or to synchronize changes from the remote repository, you must use the git push or git pull commands, respectively. The trunk code line in Git, by convention, is a branch called 'master'. The remote repository, again by convention, is known as 'origin'. The following is a brief list of useful git commands, and their results.
git clone ssh://<user name>@<git host>/<git repository>
This will grab all branches available in the remote repository and create a local copy of it all, to which you can commit your changes.
git checkout <branch name>
For instance, switching to the trunk can be accomplished with git checkout master.
git pull origin <local branch name>:<remote branch name>
If you don't have a local copy of a new remote branch, this will solve that problem.
git add <file spec>
Given a directory name, add will operate recursively on the directory structure, so to add all new files recursively, from the current directory, you would use...
git add .
You can limit this using wild cards, as in git add ./*.xml to add all new .xml files recursively, form the current directory.
git rm <file spec>
git commit
If you would like to avoid specifically adding new files with git add, and removing unwanted files with git rm, then you can simply use...
git commit -a
...which will notice new files and add them, and will notice deleted files and remove them.
git pull
git push