CS 458 - Week 3 Lab - 2016-09-07

*   Intro to git/GitHub - part 1 (mostly git, today!)

*   you can use

    git --version

    ...to see the version of git you are running

*   you can use

    man git

    ...to see git's UNIX manual page

*   and 

    man git <cmd>

    ...to see the man page for git's <cmd> command

    *   don't be fooled -- man page WRITES 
        git-<cmd> in the documentation,
	but you TYPE

	git <cmd> etc.

	....to RUN that git command

*   you can configure your git at several levels
    using git's config command

    *   system level, user level, and at the
        repository level

    *   FOR EXAMPLE -- to set the user name 
        for all of your repos on nrs-projects,

        (so, for all at user level -- that's
        flag --global)

	you'd use:

	git config --global user.name "firstname lastname"

        example:
	git config --global user.name "Sharon Tuttle"

    *   git config --list

        ...lists your current configuration settings

*   you NEED to set your user.name (as above)
    and your user.email to be able to work with
    GitHub;

     so you also need:

     git config --global user.email "valid email addr"

     example:
     git config --global user.email "st10@humboldt.edu"

*   these are not mandatory (just examples of other
    settings):

    git config --global color.ui auto

    ...to get automatic git syntax coloring in
    sshe implementations that support that

    git config --global core.editor desiredEditorName

    example:
    git config --global core.editor emacs

*   BECAUSE line-feed characters DIFFER on different
    OSs,

    you PROBABLY should change the default behavior
    for line-feeds in git;

    this is core.autocrlf

    ...what should Git do, if anything, about line feeds?

    the default (which you should probably change):
    is core.autocrlf=false
    *   don't make ANY changes to any linefeeds
        to checked-in files ever

    for Windows users:
    recommended:
    core.autocrlf=true

    *   means: when you write a file to Git's
        object database it CHANGES Windows CRLF
	(2-character) line feeds to the UNIX standard
	LF line feed;

	AND when you get a file a file BACK from
	that, it changes all LFs into CRLFs

    *   the command to set this:

        git config --global core.autocrlf true

    for UNIX/Linux/Mac OS X users:
    recommended:
    core.autocrlf=input
    
    *   means: when writing a file to Git's object
        database, change any stray CRLFs (say you
	pasted from a browser, or a Windows user emailed
	it to you) to LFs

	BUT when you get files back, LFs are left
	as-is (because that's what you want here)

    *   the command to set this:

        git config --global core.autocrlf input

*   to make a NEW repository:

    git init newprojectname

    example:
    git init 458lab3-fun

    *   creates a new directory 458lab3-fun with
        repository pieces within
	(do 
	ls -l
	...to see the .git subdirectory in your
	new repository)

*   Oh, I have a project, I want to make it 
    into a repository!
    *   cd to the directory containing the files
        of your project (that you now want to make
	into a git repository as well)

    *   make the current directory a git repository
        using:
	git init

    *   you need to add the existing files to
        the new repository
	(this is if you WANT all of them...)

	FIRST stage them for a commit with add:
	git add .

        THEN commit all the add(s) with commit:

	git commit -m "desired message for log"
                   ^ means here is the log message
		     for this commit - I can make this
		     whatever message I would like

        example:
	git commit -m "just turned old-project into repo"

*   to see the status of the current repo:

    git status

*   to see the log messages for all commits:

    git log