What is Git?
Git is a free/open source version control system. That is, Git manages files and directories, and the changes made to them, over time. This allows you to recover older versions of your data or examine the history of how your data changed. In this regard, many people think of a version control system as a sort of “time machine."
ITS currently recommends the command line interface of Git, but you are welcome to use a Git client that suits your needs.
Git hub offers a nice start up guide for Git.
What are some Git GUI clients?
|Mysysgit||https://git-for-windows.github.io||GUI Windows client|
|SourceTree||https://www.sourcetreeapp.com||Free GIT GUI client for Windows and Mac|
|Tower||http://www.git-tower.com||Commercial GUI client for Mac|
|GitKraken||https://www.gitkraken.com||Awesome dual platform GIT GUI Client for Mac, Windows and Linux, Free with commercial options|
Is there more Git documentation you recommend?
- http://help.github.com/ -Some of their guide is specific to github, but it is probably the best introduction to basic topics.
- http://git-scm.com/documentation - is also a pretty good reference
- http://help.github.com/git-cheat-sheets/ - very helpful quick guide.
Getting Access to the UCSF Drupal Git Repository
To work with our Acquia Enterprise Cloud Hosting Environment you will need to request an account using your UCSF email address from us.
You will need to tell us what Hosting environment you will be requesting access to, Drupal 6 Multi-site or Drupal 7 Multi-site.
Once you have your account in Acquia setup you can add your RSA SSH keys to the environment:
- Login to accounts.acquia.com
- Goto Credentials in your User profile
- Click the Add SSH key
For further details see this documentation:
Getting started- Cloning the current Master Copy
We have several different web roots on the Acquia platform, if you are doing custom development you are most likely using the UCSFp1 environment.
Make a directory for all your Git projects
Open the Git command line client
- Change directory to the git-projects directory
Example: cd /c/dev/git-projects
Clone the existing repository to your local machine
D7: git clone [email protected]:ucsfp1.git
Example git status
- Set up your own branch for changes
git checkout -b mybranch
Daily Work Flow
Synch your local master repository to the remote master
Add your changes to your local repository in
git add /docroot/sites/yoursites.ucsf.edu
Commiting your changes
The git commit command adds you changes to the current local version of the branch.
git commit -m "my change message goes here"
Merging your branch change to the master copy
check what branch you are in
Check out the master branch
git checkout master
Merge your changes into the local master branch
git merge mybranch
Merge your changes into the remote master branch
git push origin master
For When "Something Goes Wrong"
Checking When a File was Last Changed and by Whom
git log filename
Removing a Directory Full of Files
git rm -r bad_directory/
Resetting Your Local Repository
git fetch origin
git reset --hard origin/master
A more readable git log of commits
alias gitp='git log --graph --pretty=format:'"'"'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'"'"' --abbrev-commit'