I took this class called git in udaticy and these are my notes i took for the future i need to references them all the time


PLAYLIST: https://youtu.be/w1JOF67Kaew&index=2&list=PLAwxTw4SYaPk8_-6IGxJtD3i2QAu5_s_p#t=34.119319

COMPARE FILES:

windows: $ FC first-file.txt second-file.txt

MAC: $ diff -u first-file.txt second-file.txt

$ git log
https://youtu.be/w1JOF67Kaew?t=2s

$ gif diff CommitNumber_1 CommitNumber_2
https://youtu.be/w1JOF67Kaew?t=1m30s

$ git log --stat
https://youtu.be/kBOXmGll8N0?t=1m30s
// --stat  WILL SHOW YOU WHICH FILES WERE AFFECTED

# CLONING A REPOSITORY
https://youtu.be/WQjNhypqwNE?t=30s
$ git clone https://github.com/...
NOTE: its better just to get the latest version with the --depth=1 option

# CONFIGURE COLORS:
https://youtu.be/WQjNhypqwNE?t=30s
$ git config --global color.ui auto

# CHECKOUT
https://youtu.be/enodgfNvUsc?t=15s
https://youtu.be/enodgfNvUsc?t=2m30s
$ git checkout CommitId


you are now in 'detached HEAS' state
https://youtu.be/enodgfNvUsc?t=2m30s

SETTING UP YOUR GIT (SETUP or CONFIGURATION)
https://classroom.udacity.com/courses/ud775/lessons/2980038599/concepts/33417185870923#
https://youtu.be/IfLhXM4RnB4


https://youtu.be/IfLhXM4RnB4
##############################################################
Setting Up Your Workspace on Windows
##############################################################
You can download .bash_profile_course here:
https://www.udacity.com/api/nodes/3341718587/supplemental_media/bash-profile-course/download?_ga=1.37232743.672083044.1467344711

Downloading necessary files

Save this file in your home directory with the name git-completion.bash.
https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash

Save this file in your home directory with the name git-prompt.sh.
https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh

SETUP DEFAULT TEXT EDITOR
git config --global core.editor "'C:/Program Files/Sublime Text 2/sublime_text.exe' -n -w"
git config --global push.default upstream
git config --global merge.conflictstyle diff3

https://youtu.be/IfLhXM4RnB4?t=4m40s

Make sure you can start your editor from Git Bash
If you use Sublime, you can do this by adding the following line to your .bash_profile:
alias subl="C:/Program\ Files/Sublime\ Text\ 2/sublime_text.exe"
##############################################################

CONFIGURATION FOR MACS OR LINUX:
https://youtu.be/s_eFuGauy6k

LESSON 2

$ git init
https://youtu.be/PZveoC4c-2s?t=19s

ERROR MESSAGE:
fatal: bad default revision 'HEAD'
explained here:  https://youtu.be/2wUlwJf0N_M?t=2s


$ git add
https://youtu.be/t6GMcIoCD9Q?t=1m10s

$ git commit
https://youtu.be/2AOLeYpVHzk?t=12s

HOW TO COMPARE THE DIFFERENCE BETWEEN YOUR working directory VS stagin area?
https://youtu.be/qdR5B6Pl-ks?t=2m10s
$ git diff

$ git diff --staged
https://youtu.be/qdR5B6Pl-ks?t=3m05s

$ git diff --hard
https://youtu.be/qdR5B6Pl-ks?t=3m50s

GIT BRANCHES EXPLAINED:
https://youtu.be/OY7bXtn1afU

CAN YOU COMBINE TWO BRANCHES TOGETHER? (konwn as MERGING)
https://youtu.be/OY7bXtn1afU?t=2m30s


CREATING A NEW EXPIREMENTAL BRANCH

VIEW CURRENT BRANCH:
$ git branch

CREAT A NEW BRANCH NAME: branchName
$ git branch branchName

CHECKOUT A BRANCH
// now that you have created a new branch, you will need to checkout to work on it
$ git checkout branchName
// now you can confirm you really have checked out the new branchName branch by viewing your current branch:
$ git branch


// THIS COMMAND WILL CREATE A NEW BRANCH NAME AND CHECKOUT THE BRANCH NAME AT THE SAME TIME IN ONE COMMAND
$ git branch -b branchName
https://youtu.be/NOy4opLU6os?t=1m05s

COLABORATION:
// this video explains how you can have multiple branches when people are working on a project
https://youtu.be/aG2Bx9WsMXY

Branch branchName set up to track remote branch branchName from origin.
switched to a new branch 'branchName'

$ git log --graph --online branchName branchName2
https://youtu.be/aG2Bx9WsMXY?t=2m40s

an elipses is a three dotted (3 dots) to represent time
example ...
... example
https://www.youtube.com/watch?v=B8qKGCtKBLY&index=48&list=PLAwxTw4SYaPk8_-6IGxJtD3i2QAu5_s_p

COMBINE BRANCHES TOGETHER (MERGING)
https://www.youtube.com/watch?v=fGc5kBtBRow&list=PLAwxTw4SYaPk8_-6IGxJtD3i2QAu5_s_p&index=52
https://www.youtube.com/watch?v=IaXmT7A5FBY&index=56&list=PLAwxTw4SYaPk8_-6IGxJtD3i2QAu5_s_p

TO MERGE BRANCHES DO THIS COMMAND:
$ git merger branchName1 branchName2
# enter comments if needed in your text editor
$ gi log // to view the new changes

https://youtu.be/xsJzPSksa4g?t=2m0s
$ git show

HOW TO DELETE A BRANCH IN GIT
// this does not delete the commit ids in the merged branch, but only the label
$ git branch -d branchName
https://youtu.be/xsJzPSksa4g?t=2m15s


git error message: CONFLICT (content): merge conflict in fileName
Automatic merge failed; fix conflicts and the commit the result.
https://youtu.be/iRyUUGsNHrU?t=0m20s

you can find conflicts by looking at git with less than signs <<<<<<<<<<<<<<<

git log -n 1
https://youtu.be/KdQxfuQzzno?t=6s
// SHOWS THE LAST COMMIT?