These are my notes from reading Scott Chacon’s Pro Git I highly suggest buying this book if you are serious about using the Git version control tool. pg 48 A branch in Git is simply a lightweight movable pointer pg 50 a special pointer called HEAD…is a pointer to the local branch you’re currently on pg 52 Creating a new branch is as quick and simple as writing 41 bytes to a file (40 characters and a newline). pg 53 To create a branch and switch to it at the same time…git checkout command with the -b switch pg 61 To see the last commit on each branch, you can run git branch -v pg 69
| |
is the same as
| |
pg 81 Git protocol…listens on a dedicated port (9418)
pg 82 The Git protocol is the fastst transfer protocol available.
pg 111 The Git project provides a document that lays out a number of good tips for creating commits from which to submit patches—you can read it in the Git source code in the Documentation/SubmittingPatches file.
| |
pg 121 Compare origin changes with local changes before merging:
| |
| |
| |
It’s almost identical to running a patch -p1 command to apply the patch, although it’s more paranoid and accepts fewer fuzzy matches then patch. pg 131
| |
check to see if a patch applies cleanly before you try actually applying it pg 134
| |
To find common ancestor of both branches
| |
| |
| |
shows you only the work your topic branch has introduced since its common ancestor with master. pg 140 tagging releases with signed keys pg 141 generating a build number with yocategory preparing a release as a tarball pg 142 Show work by author since a specific time
| |
pg 144 Git can figure out a short, unique abbreviation for your SHA-1 values
| |
wolves paragraph pg 145 Find out the SHA1 of a branch
| |
pg 146 To see reflog information inline with your normal log information
| |
Because reflog is a log, it will show you where the HEAD pointer was 2 months ago – if the repo is older than that
| |
pg 147 ^ is the first parent of the current commit^2 is the second parent of the current commit (only works if the current commit is a merge commit, where first parent is the branch you on when you merged, second was the other)~ is the first parent~2 (or any number) is the grandparent(s) of the current commit only on the current branch or branch you were on when you merged pg 148 Shows you any commits in your current branch that aren’t in the master branch on your origin remote
| |
Git substitutes HEAD if one side is missing (git log origin/master..) Just like above command and example shown on pg134
| |
pg 155 Tells the stash command to try to reapply the staged changes
| |
pg 156 Create a branch from a stash, testchanges
| |
pg 157 …don’t amend your last commit if you’ve already pushed it (git commit —amend command)
| |
Don’t include any commit you’ve already pushed to a central server—doing so will confuse other developers by providing an alternate version of the same change pg 158 It’s important to note that these commits (interactive rebase) are listed in the opposite order (oldest first, newest last) than you normally see then using the log command (newest first). pg 160 …make sure no commit shows up in that list (git log -4 —pretty=format:“%h %s”) that you’ve already pushed to a shared repository pg 164 was wondering how to automate the good/bad declaration pg 168 git submodule updateYou have to do this every time you pull down a submodule change in the main projects. It’s strange, but it works. pg 172 (subtree merging) You want to pull the Rack project into your master project as a subdirectory
| |
pg 175 global git config /etc/gitconfig user global git config ~/.gitconfig local repository git config .git/config pg 182
| |
This setup should leave you with CRLF endings in Windows checkouts but LF endings on Mac and Linux systems and in the repository pg 184 To tell Git to treat a specific file as binary data, add the following line to your .gitattributes file:*.extension -crlf -diff pg 185 …one of the most annoying problems known to humanity: version-controlling Word documents (LOL) pg 192 post-receive hook…This scripts can’t stop the push process, but the client doesn’t disconnect until it has completed; so, be careful when you try to do anything that may take a long time pg 194 Is practically the git log command…it prints out only the SHA-1 values and no other information
| |
Get the commit message from each of these commits to test git cat-file commit [SHA-1] Incantation:
| |
Comments Link to heading
Ricardo: Thanks for the compilation!
Jason Meridth: Ricardo: You’re welcome
Simon: You’ve convinced me to buy this book now.
Jason Meridth: @Simon: Awesome. It’s worth it’s weight in gold.