
Users can then switch between branches as required using: $ git checkout Which will create a new local branch, which tracks against the remote branch, and also change the working tree to the local branch (so any changes you make, you're making to the branch). Users will then be able to checkout the remote branch by using: $ git checkout -b origin/ Push it to the origin server: $ git push origin NOTE: This method does not require you to switch to the local branch in order to push it to the remove server.Ĭreate the local branch (from the branch you're currently in (generally "master")): $ git branch To revert modified files in your working tree (the equivalent of cvs co -C ): $ git checkout - path/to/fileĪ git status will give you a list of files in your working tree which are modified. This should bring your tree into sync with the repository and then it will allow you to git push. You need to cd projectroot and do a git pull. If you encounter a (non-fast forward) error on push: To master -> master (non-fast foward)Įrror: failed to push some refs to that means that your tree is now out of sync with the main repository. # At this point git will open your default editor and ask for a commit messageĬreated commit ed16907: fixed #2345: patched file to fix somethingġ files changed, 2 insertions(+), 0 deletions(-) Resolve a Failed Push This example shows using git -a to commit all changed files $ cd util/dd/src/js $ git commit -m "Updated the README file"Ĭreated commit 794a86f: Updated the README fileġ files changed, 1 insertions(+), 0 deletions(-) git commit all This example shows using git add to add each file to the commit index before committing. git rm This lets you remove files and directories.git status Shows you the status of your repository.git push This is what moves your local repository to the server you checked out from.git add This is a little different, you use git add to add a file to the commit index.git commit This will commit changes to your local repository (not the server).git pull This will pull a fresh copy of the repository.Most of the built in aliases for git will help because they are similar to CVS. So you can commit to it as much as you like. Git is a little different than CVS, every person has a copy of the repository on their local machine. Click the links below for more information: GitHub has several helpful tutorials on setting up SSH for use with git. My current ~/.gitconfig looks like this: Įxcludesfile = /Users/davglass/.gitignore These configs should be written to this file (same for Windows, when working in Git Bash): ~/.gitconfig. Git config -global user.email your name and email of course there are many other configuration options you can set. Setting user.name and user.email are the minimum configuration options that need to be set so your name and email will show up in your commit messages.
#SSH GIT ON MAC WINDOWS#
You need to add this config option to help Windows deal with line endings: git config -global tocrlf true
#SSH GIT ON MAC INSTALL#
#SSH GIT ON MAC MAC#
If you have Mac Ports installed, do the following: You should see something like this: git version 1.7.6.1.At the bottom of the file add this line:.You will need to add /usr/local/bin to your $PATH.Download and Install Git package for OS X.You should see something like this Version may vary: git version 1.7.6.1.Download and Install Git Client for OS X.You should see something like this Version may vary: git version 1.7.4.4.After installation open a terminal and type: git -version.Download and Install Xcode 4 from the Mac App Store (it's free).
#SSH GIT ON MAC HOW TO#
Once your environment is set up, be sure to read Tutorial: Contribute Code to YUI to learn how to clone YUI source code to your local development environment, and submit a CLA to contribute to YUI. This tutorial walks you through how to set up Git on various platforms so you can be reading and writing YUI code in no time.
