-
Start-of-lecture Slides
(Required) Online students will need to read these on their own.
Hybrid students will see them at the start of class.
-
Useful links:
-
http://git-scm.com/book/en/v2
Nice, although it tends to dive into the details
immediately.
-
https://www.gitignore.io/ - to generate .gitignore files
-
Download and install git
-
Let's use Atlassian Source Tree
-
We're going to use use git-extensions, which works well
on Windows (and apparently can run under Mac/Linux using
Mono).
It looks like the project is currently hosted on GitHub,
even thought the top link goes to SourceForge. It
appears that SourceForge has the same installer package as
the GitHub site (at least as of 1/29/2016).
Download for Windows:
http://sourceforge.net/projects/gitextensions/
Project Home page:
https://github.com/gitextensions/gitextensions (at the
bottom there's a link for Mac/Linux users)
-
Note that while git-extensions includes a Visual Studio
plugin we're going to be using the command prompt for
everything. Why?
-
Almost all the online help for git uses the command
prompt.
If you get stuck there won't be any advice for the
plugins or GUI (typically) but there will be advice on
using the command prompt.
-
git is robust, solid, and reliable, but still
immature in the sense that people are still figuring out
how best to use it. Plus, it's open-source, which
tends to produce more options for a given task anyways.
There are _lots_ of specialized options out there, each
one of which has a small audience of users.
The prompt is the 'common denominator' for all git
users, so that's how people typically use it (and post
help on it)
-
If you want to work in computers then you need to
know how to use a command prompt. We won't be
using it much, but it will be enough to get you a good
introduction to this
-
Introduction to the bash shell
Important points:
-
Nowadays people use the command-line interface for
issuing commands to the computer and for scripting (because
it has a built-in programming language).
It *used* to be that people would use the command-line shell
for all their interactions with the computer - everything
from moving files around to starting programs.
Nowadays GUIs are much easier to use for these sorts of
things so we don't use the CLI shell anymore
It's worth noting that this used to provide a nice, smooth
path from just using the shell for routine things, to
learning a little bit (a loop, say) in order to automate
something small, to learning more about shell scripting,
etc, etc.
Take-away: while you need to know how to use the shell well
enough to issue commands to git you should plan on
continuing to use your GUI as much as possible
-
Note that this means that if you search the web for
help with "bash shell" you'll probably find more
references on shell programming than you will on
actually using the shell.
-
Start the git bash to get a command prompt
-
Note that people sometimes refer to the program as
the 'shell', or the 'bash shell', or just 'bash'.
-
Walk through the tutorial at
http://swcarpentry.github.io/shell-novice/ (note that
it's not enough to double-click on the .ZIP to extract it -
you need to right-click on it and the select "Extract
All...", just like
-
Read the above page for an overview of why people
still use the shell
-
Read
the first bash shell tutorial to understand the
'story' used in the tutorials
-
As you read
the second bash tutorial make sure that you follow
along on your computer, step by step.
-
You should read
the third shell tutorial and follow along with the
steps that it outlines.
These sorts of commands you should normally do with your
GUI instead of the CLI, though. I want you to read
this stuff even though you won't use it because the git
tutorials will use these commands and so you should be
familiar with what they are.
-
Getting started with git - overview
We're going to first do an online tutorial and then do
a practice run with an online simulator
-
The the overview / motivation at
http://swcarpentry.github.io/git-novice/ and
the first git tutorial to understand what version
control is used for
-
At this point you should switch gears and go for a
'guided tour' of how git is used, using the interactive,
online tutorial:
https://try.github.io/levels/1/challenges/1.
-
The basic idea is that you can type the command into
the 'prompt' and then hit enter and it'll show you the
result.
Alternately you can push the button to have it type the
command in for you (but you still have to hit enter to
actually make the command happen).
-
Each step also has a brief explanation about what the
step does. At the bottom-left of the page is a
'file browser', and the bottom-right has some
interesting tips.
-
Expect to spend a minute or so per step, so about
half an hour on the entire thing.
The goal here is to get an idea of how git works but NOT
to become an expert in everything all at once.
Steps 1.1 through 1.9 cover the basic process of adding
stuff to the repo
Steps 1.10 - 1.12 are about remotes (remote/online
servers) - you will need to know this
Steps 1.13 - 1.17 are about comparing files (between
your working copy, the files you've committed to your
repository, and the files that have been temporarily
stored in your staging area).
Steps 1.18 -1.25 are about branches - easy branching is
one of the nicest features of git, but one that we won't
be using much. Zip through this part to see a nice
explanation/demo, but don't worry about
learning/retaining any of it for this class :)
In the next part we'll go back to the tutorial to do
actual work on your computer
- Getting started with git - working with a local repo
Essentially what we're going to do is practice
committing stuff to our local repo. If this is all you did
then you'd basically be making local backups of your work.
-
The
'Setting Up Git' tutorial will tell you how to enter
your email address, set up a default editor, and
generally edit & check your config settings. Note that Notepad++ is not built into Windows - you need
to download that separately. I think that you can
also just skip the editor step - it'll use the normal
Notepad by default, but it only does this if you leave
out the commit message when committing (so if you type
the message in on the command line you won't need to use
the editor)
-
Maybe point out
http://git-scm.com/book/en/v2/Getting-Started-Getting-Help
somewhere along the line
-
The
Creating a Repository tutorial will walk you through
creating a new repo from scratch.
-
The
Tracking Changes tutorial
is probably the most
important tutorial in this collection. It shows
you how to make changes to your files, and the save that
work into your repo.
-
Note that the author likes to use the nano
editor. Whenever the tutorial lists something
like "nano mars.txt" just imagine that they've
opened up the mars.txt file inside Visual Studio and
then they make whatever changes they describe.
-
Maybe point them at this picture/section:
http://git-scm.com/book/en/v2/Getting-Started-Git-Basics#The-Three-States
-
The
Exploring History tutorial will show you a bit about
how to interact with the files stored in your local repo
-
You can mostly skip the
Ignoring Things tutorial. It's interesting
stuff, but please be careful not to accidentally exclude
stuff that you need to hand in.
If you're curious,
the instructor uses this feature in the starter projects
to stop you from uploading your bin & obj directories
This seems like a good place to end the first lesson -
an exercise to create
me a repo, put something into it, and then email me the
output of git log, maybe
-
Getting started with git - working with a online repo
Essentially the workflow is
-
The
Remotes In Git tutorial will demonstrate how to
upload your work to something like GitHub. Read
through this BUT DO NOT DO THIS
SKIP THIS?
DO NOT UPLOAD YOUR HOMEWORK TO GITHUB If you do you're sharing your homework on the Internet,
which violates the plagiarism policy for this class.
(Include plea to not share stuff here? Point out
that this is all foundational skill-buliding, you need
to do this for yourself in order to learn it, and I
can't create 50 individual variations on each exercise
each time I teach this course?)
-
Instead of showing the above, what about something
GitLab-specific?
-
Exercise: Clone/fork a repo on GitLab, make sure it's
private, edit it online, and then get it ready to be graded
-
Exercise: Pull private fork to local machine, make a
change, push it back to the server, prep it for grading
-
|