mkdir test_git_dir cd test_git_dir echo CoolCodingStuff > MyFirstFile.txt ls #Check status of folder - THIS will fail git status #Its not a git repo yet - lets make it one git init ls -la #Note the .git dir - this does everything #Check again - There is an untracked file git status #Lets track the file we made git add MyFirstFile.txt #Check again - still not done git status git commit -m 'Initial Save' git log git log --stat #Modify file echo NewMod 1 >> MyFirstFile.txt git status git diff git add MyFirstFile.txt git commit -m 'ENH - Code has NewMod technology added' git log --stat #Add a second file and track echo ThisIsTheCoolestNewFileStuff > AllTheRage.txt git add AllTheRage.txt git commit -m 'Initial' #Search history #NewMod technology was a bad idea - need to go backwards #The ~3 says go 3 commits backwards from designated (here master is the branch) #The checkout could also be a specific hash ID git checkout master~3 git status git branch awesome_mod git checkout awesome_mod echo This fixes everything - no more mods needed > BestModFix.txt git add BestModFix.txt echo One More thing Added to Fix >> BestModFix.txt # Now we have two BestModFix.txt - but I only want the second one git add BestModFix.txt git commit -m 'FIX - New implementation for Mod' #Now we have our modifications - but we don't have our AllTheRage file git checkout master git merge awesome_mod ## Cloning and Remotes cd .. git clone test_git_dir/ MYNEWGITCOPY cd MYNEWGITCOPY git log #I have my whole history in the copy git remote -v echo New > NewFileInCopy.txt git commit -m 'ENH - This makes it run faster' git log #Notice where origin/master is located - need to update git push #Not setup to do this cd ../test_git_dir git pull ../MYNEWGITCOPY cd .. mkdir gitRepo cd gitRepo git init --bare cd ../MYNEWGITCOPY git remote add MyRepo ../gitRepo git remote -v git push MyRepo git log #Note where MyRepo is located echo NewStuffAgain >> ForUploadToRepo.txt git add ForUploadToRepo.txt git commit -m 'This is for the repo' git log #See that MyRepo is out of sync git push MyRepo cd ../test_git_dir git remote -v #No Remotes - this was our original git remote add MyRepo ../gitRepo git fetch MyRepo #This may throw a warning to do the following git branch --set-upstream-to=MyRepo/master master git fetch #We now see that we are out of sync git pull #This is essentially what github is doing, but its just on another computer #There are some other fancy attributes that you will see in