Using git for Source Control 101

Using git for source control has become ubiquitous with software development, and has largely replaced older source control methods, including CVS, and Subversion (SVN).  Here’s some of the more common git commands.

Initializing a Repository

Here are the basic commands to initialize from a new or existing repository.  Note, that the git add , git commit , and git push  commands are the most common commands that you will use, repeatedly, and in that order, when making changes to code that is under git source control.

 

Checking Status and Getting File Diffs

Reverting, Resetting, and Cleaning – Be careful with these next commands!

Real-World Usage:

Stashing, instead of Resetting

Instead of resetting, you can accomplish the same with git stash , and even use the changes later if you change your mind.

 

%d bloggers like this: