Skip to content

Instantly share code, notes, and snippets.

@matthewmccullough
Created January 10, 2012 15:11
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save matthewmccullough/1589518 to your computer and use it in GitHub Desktop.
Save matthewmccullough/1589518 to your computer and use it in GitHub Desktop.
January GitHub Git Foundations Class Notes

January GitHub Git Foundations Class Notes

How did you do that init again?

git init project2
cd project2
git status
mate index.html
git status

Our code

<body>
   <p>First paragraph</p>
   <p>First paragraph</p>

   <p>Second paragraph</p>
   <p>Second paragraph</p>

   <p>Thirda paragraph</p>
   <p>Thirdb paragraph</p>
</body>

Configuring the editor

git config --global core.editor "theprogramhere"

The editor should already be on your path such that you can run it by just typing its name at the prompt.

Notepad++ help can be found here

Diffing

git diff
git diff --staged
git diff HEAD

Git Add Patch Mode (Interactive)

git add -p
# answer s for split, y for yes, n for no

Limit View of History

git log --author=Matt
git log -3
git log --stat
git log -p

Restore to last committed state

git reset --hard

Git Similarity Index Discussion

http://permalink.gmane.org/gmane.comp.version-control.git/217

Student Questions

Git for "my" Team

  • I have to take what I already know of github (a fair working knowledge plus today's course) back to a team of 4-5 devs (2 remote)
  • They don't know github
  • I have to convince them why they should bother learning github
  • Be able to teach them enough so that we can all use it to work on our source code.

Collaboration

  • The one question I know I'm going to get the most is if we all have our own cloned versions of a private github repo, how does one developer know what the other devs are working on?

Binaries

  • What are the best practices for handling that especially for binary files like Flash FLAs?

Resetting

  • Can you reset an individual file?

      git checkout HEAD -- <FILENAMEORPATHNAME>
      git checkout -- pageuno.html
      git checkout HEAD -- pageuno.html
    

Cloning

git clone https://githubstudents:students987@github.com/githubstudents/hellogitworld.git
cd hellogitworld
git branch yournamegoeshere
git checkout yournamegoeshere
<create a new file called yournamegoeshere.txt>
git add yournamegoeshere.txt
git commit -m"message here"
git push -u origin yournamegoeshere:yournamegoeshere

Adding a remote

git remote add matthewongithub https://github.com/matthewmccullough/hellogitworld

Checking out a remote branch to work on it

# Short form
git checkout feature_image
# Long form (if short is ambiguous)
git checkout -b feature_image --track origin/feature_image

How do I see what would be pushed from master?

git log --pretty=oneline master origin/master

What is your command line decoration (shell prompt?)

https://github.com/robbyrussell/oh-my-zsh With the gozilla theme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment