Skip to main content
Home
Grace in Motion

Main navigation

  • Home
  • About
User account menu
  • Log in

Breadcrumb

  1. Home

Pro Git Chapter 2 notes

By admin, 29 April, 2012

There are no chapter one notes.

.gitignore can have rules:
# a comment - this is ignored
*.a       # no .a files
!lib.a    # but do track lib.a, even though you're ignoring .a files above
/TODO     # only ignore the root TODO file, not subdir/TODO
build/    # ignore all files in the build/ directory
doc/*.txt # ignore doc/notes.txt, but not doc/server/arch.txt

git diff shows changes not yet staged
git diff --cached or --staged shows staged but not committed
git commit -a -m 'comment'

git rm stages deleted files, removes from tracking & working directory (might need -f is you already modified and staged?)

git log shows commit history; add -p to show diff; -2 shows last 2
there are many formatting options for logging: git log --pretty=oneline

git reset HEAD -- filename unstages filename. Still modified (resets the index to what it was)
git checkout -- filename undoes modifications back to last commit; forever, no redo

git remote lists; -v shows url
git remote add alias url

git fetch pulls changes from remote; then you merge
git pull fetches a branch, pulls into current branch you are in
git clone adds remote repository as 'origin'. sets up a 'local master' to track 'remote master'

git push [remote-name] [branch-name]: when you want to share; only works if nobody has pushed in the meantime; otherwise pull first

remotes can be removed and renamed:
git remote rename pb paul
git remote rm paul

git tag shows all tags
git show shows annotated tag
git tag -l 'search term'
git tag -a 'tag' -m 'annotation'
git push origin [tagname] tags need to be explicitly pushed
git push --tags pushes all tags

Recent content

  • Titles and GSD
    2 days 3 hours ago
  • Execs are wearisome to train
    1 month ago
  • Your support team is your most important user
    1 month ago
  • Talking about culture
    1 year 6 months ago
  • Recession Proofing
    2 years 3 months ago
  • Relearning Drupal, Preface
    2 years 3 months ago
  • 2023 Reset
    2 years 3 months ago
  • Antipatterns in Saas, cont'd
    2 years 3 months ago
  • Drupal 10 is not super easy
    2 years 4 months ago
  • Being a Q AND A Man
    2 years 7 months ago
RSS feed
Powered by Drupal