Git: Difference between revisions

From Cheaha
Jump to navigation Jump to search
(Move transition text out of this page and into Git Primer)
mNo edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 2: Line 2:


== Git Primer ==
== Git Primer ==
So, that's what [[wikipedia:Git|Wikipedia says about Git]]. And it is of course all true.   
The above summary is what [[wikipedia:Git|Wikipedia says about Git]]. And it is all true.   


Unfortunately, that definition is all very clinical. That perspective is not gonna do much to help you know why you should even bother with Git.  
Unfortunately, that description is very clinical. It's not going to help you understand why you should even bother with Git.  


To answer that question, you need to know what Git does for you.  You need to know what problems Git solves for you and how to get yourself out of a pickle when you find out you've been using your hammer all wrongYou need to be able to learn while using Git, to fix mistakes you discover along the way.
The short answer to why you should bother with Git, is that it helps you maintain a history of changes to your files. By maintaining a history, you can return to an earlier version of your file before "when everything just worked".  This useful for all kinds of files, but is especially useful for files that provide instructions to a computer to implement the steps of a process you are documenting.
 
A longer answer to that question requires knowing a little more about what it means to document a process.  You need to know how Git helps you with that work.  You need to know the problems Git solves for you and how to get yourself out of a pickle when you find out your instructions are broken.   
 
Most importantly, you need to be able to learn how to use Git along side your normal work. Get started with some basic commands and fix mistakes you discover along the way.


To answer why to use you want to use Git, read the the [[Git Primer]].
To answer why to use you want to use Git, read the the [[Git Primer]].
== Git Basics ==
The three basic steps for maintaining your history are:
# edit a file
# add the changes you want to track
# commit those changes to your history
Repeat this process as long as you need to.
This process can be used to build elaborate repositories that have a complete history of all the work that went into creating the repository. Git will help you revisit any point in that history.
=== One Time Setup ===
Install Git and record your name and an email address where you can be reached.
=== Tracking Changes ===
Git assumes you will organize all related files for a project, a set of related files, under a common parent directory. That means, whenever you start working on a new project you should first create a directory that will contain the files that belong to that project.
mkdir mynewproject
cd mynewproject
git init
echo "hello git" > hello.txt # create a file
git add hello.txt  # tell git you want to record the changes made to hello.txt
git commit -m "start tracking hello.txt" # commit the changes to your history
== Git for Beginners ==
[[Git For Beginners]]


== Git for Developers ==
== Git for Developers ==


[[UsingGitForDevelopment]]
[[UsingGitForDevelopment]]
== Git for MATLAB ==
[[Git For MATLAB]]

Latest revision as of 15:21, 11 July 2018

Git is a distributed revision control system with an emphasis on speed. Git was initially designed and developed by Linus Torvalds for Linux kernel development. Every Git working directory is a full-fledged repository with complete history and full revision tracking capabilities, not dependent on network access or a central server. Git's current software maintenance is overseen by Junio Hamano. Git is free software distributed under the terms of the GNU General Public License version 2.

Git Primer

The above summary is what Wikipedia says about Git. And it is all true.

Unfortunately, that description is very clinical. It's not going to help you understand why you should even bother with Git.

The short answer to why you should bother with Git, is that it helps you maintain a history of changes to your files. By maintaining a history, you can return to an earlier version of your file before "when everything just worked". This useful for all kinds of files, but is especially useful for files that provide instructions to a computer to implement the steps of a process you are documenting.

A longer answer to that question requires knowing a little more about what it means to document a process. You need to know how Git helps you with that work. You need to know the problems Git solves for you and how to get yourself out of a pickle when you find out your instructions are broken.

Most importantly, you need to be able to learn how to use Git along side your normal work. Get started with some basic commands and fix mistakes you discover along the way.

To answer why to use you want to use Git, read the the Git Primer.

Git Basics

The three basic steps for maintaining your history are:

  1. edit a file
  2. add the changes you want to track
  3. commit those changes to your history

Repeat this process as long as you need to.

This process can be used to build elaborate repositories that have a complete history of all the work that went into creating the repository. Git will help you revisit any point in that history.

One Time Setup

Install Git and record your name and an email address where you can be reached.

Tracking Changes

Git assumes you will organize all related files for a project, a set of related files, under a common parent directory. That means, whenever you start working on a new project you should first create a directory that will contain the files that belong to that project.

mkdir mynewproject
cd mynewproject
git init
echo "hello git" > hello.txt # create a file
git add hello.txt  # tell git you want to record the changes made to hello.txt
git commit -m "start tracking hello.txt" # commit the changes to your history


Git for Beginners

Git For Beginners

Git for Developers

UsingGitForDevelopment

Git for MATLAB

Git For MATLAB