Git cheat sheet


Git largeI have been working with Git for solution control on and off for about five years. I recently decided it was time to stop relying on applications to do my work and that it was time to learn to use Git Command line. The following are all of the commands I have learned so far.

I recommend forking this project on GitHub and using it to test with octocat/Spoon-Knife you can see how to do that here Fork A Repo

[wp_ad_camp_3]

Branches

List all the local branches the one wit the star is the current checked out branch.

git branch

List all the remote branches

git branch -r

Create a new branch with the name of BranchOne

git branch -b BranchOne

Delete local branch

git branch -D BranchOne

Delete remote branch

Git push origin --delete BranchOne

Fetch

Fetches all remote branches

Git fetch –all

Pull

To update all local branches that track remote

Git pull --all

Merge

Merging two branches is something that we need to do alot

Check out the first branch
Git checkout BranchOne
Merge the code from the second branch into the first branch
Git merge BranchTwo
Shows what files have been changed by the merge.
Git status


About Linda Lawton

My name is Linda Lawton I have more than 20 years experience working as an application developer and a database expert. I have also been working with Google APIs since 2012 and I have been contributing to the Google .Net client library since 2013. In 2013 I became a a Google Developer Experts for Google Analytics.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.