Git Setup
Download Git
http://git-scm.com/downloads
Download Git Extensions
http://code.google.com/p/gitextensions/
Install Git First
then
Install Git Extensions and disable msysgit
Configure Git Extensions
This is the easiest way to get started
You can perform these steps from the command line
Load Git Extensions
Choose the British Flag for English
Setup
Setup
Setup
Putty - SSH for GitExtensions
First we must generate an ssh key
Putty
Click on the Generate button.
Putty
Move the mouse around to create random data.
Putty
Save the public and private key. Make sure a keyphase is set.
Putty
Place the files in c:\users\[your name]\.ssh
Add Key to GitHub
Click on Account Settings
Add key to Github
Under ssh keys, you will see your existing list.
Add Key to github
You will see you can't just copy your public key in, you need to add ssh-rsa to the front. Also it must be the public, not the ppk file.
Push changes to github
You may need to click Load SSH key, choose the PPK file and enter the passphrase. Your changes will now upload.
Git Extensions
Main UI. Click Create New Repository
Initialize New Repo
Choose the destination folder and Click Initialize.
It will create the folder it if it is missing.
Add .gitignore
Click on Add Default ignores and it will create a good starting set. Click Save
Commit the File
Click on the Commit button in the toolbar. Choose the Stage All button
Commit the file
Notice the file has been moved. Click on the commit button (not shown) in lower left corner.
Create an Empty Repo
Go to github.com to your profile and click on the icon next to your name.
Create New Repository
Provide a Repository name and a description. Click Create Repository
Empty Repository View
You will be provided with step by step directions for the command line tools. Copy the ssh path.
Configure Remote Repositories
In order to push code, you will need the ssh path
CONFIGURE REMOTE REPOSITORIES
Set the name to origin and copy the ssh path from the repository screen on github into the url. Optionally browse to your ssh key now so it will be saved with the repo.
Pull Repo Before Pushing
You will want to pull the repo down first just to make sure you do not have conflicts before you push.
Push your code to Github
Now you will be able to push your code. You will see origin is selected and master is the branch name.
Confirmation
You will be told this is a new branch
You will also need to set a tracking reference locally to make changes.
Creating a new branch
You may also run git branch hotfix then git checkout hotfix
Creating a new Branch
Set the name and click the Create Branch button.
Display of Branches
Both the master and Hotfix branch are current.
Make a change and Commit
We made a change to the readme.md file, changing the text to v1.0.1 and also changed the Name.
Change Back to Master
Once you make the change, you can switch back to master so we can merge that changes.
HotFix is "ahead" of master
Merge Changes into master branch
Choose the Hotfix branch, right click and choose Merge into current branch. The HotFix tag shows you will be merged. You may also be presented to origin branches if they exist.
Merge Branches
Choose Always create a new merge conflict, otherwise your changes will be "fast forwarded" into the master branch like they always existed there. If you are doing short lived local branches you may want to fast forward.
Merge Results
You can see the changes were merged and the lines come together to the same point.
Push changes to origin
Once the changes are pushed you will see the tracking branches are labeled showing that master is up to date on the server.
Cloning an existing repository
You must configure github first. By choosing this, you will authenticate, allowing you to pull a list of repositories.
Cloning an Existing repository
Choose fork / clone repository under Github.
Cloning an existing repository
Sometimes it is just easier on the command line
GIthub for windows
Github for windows
Github for window
Once it is installed, the application will search for existing repositories on your machine.
Filtering your repositories
By typing in the box, the list will narrow down to items that start with the search term. Notice it also shows the history.
Existing Repository
Once you choose a repository, the last commit is chosen and the files checked in are listed on the left.
Display Diffs
By clicking on the double arrow on the right of the file name, you will expand the diff.
Branches and Merging
By clicking the branch icon, you can switch branches or merge by clicking on the manage button.
Merging
You drag and drop the branches on the squares at the bottom.
Branch visualization
There is none. I had to dump to the shell
Checking in files
Once you make a change, the uncommitted changes will turn yellow, allowing you to commit the changes.
Pushing changes to origin
All you need to do is click sync.
Creating a new repository
Click on the add button.
Creating a new repository
View on Github
Activate the new repository
For some reason, it did not auto select it. It may have been because I had a filter.
Add the gitignore file
Github for Windows will ask if you would like the gitignore and gitattributes file added. Create a commit message and commit.
Push changes to github
It appears that until you push once on a new repository created on the client, sync becomes publish. It does the same thing.
Verify on github
If you went to Github, you would see your changes.
Make changes to Readme.md
This is the master readme file that is displayed on the home page of the repository.
Create a new Branch
Click on the icon next to master. Type Hotfix in the box under branches.
MAke changes to readme.md
In the Hotfix branch, you update the readme.md file to state the new version and check it in.
Merge changes into master
Hotfix into master. Click Merge.
Merge Conflicts
One day you will see this. Luckily this is not SVN or the old TFS
Merge Conflicts
You can choose no, and your merge will end. You will not loose a thing.
Merge conflicts
Every file that is conflicted will display in the list. You can manually change it or use the tools.
Start Mergetool
I don't always get this but when you click Start Mergetool, sometimes this command line application comes up. Hit return.
REsolving
Beyond Compare 3 Professional is the best tool for merging.
REsolving
I manually took the version line from local (branch we are merging too) and the description from remote (branch we are merging from)
Resolving
You can still back out
Cleaning up
Depending on your options, an orig file is created. I ignore it
.Gitignore
By adding *.orig to the ignore file, you will never see the new files again. They are ignored.
Commit the merge
In the comment window you would see that it was a merge. Notice that I kept v1.0.4 from master and appended HotFix Branch
Cherry Pick
Lets say you would like the Cherry Pick check-in in the master branch but not Second Change.
Cherry Pick
Notice the difference in the second check-in.
Change to master
The first thing you do is change to master.
Choose what to cherry pick
Right click on the check-in and choose cherry pick.
Cherry Pick
You will then be provided with the verify screen.
Change is applied
You now have a copy of the commit. Notice the hash is different
Original hash
The hash is different since the parents are different.
Verify correct result
Notice the second change is not in the resulting file.