Using Git and Tools
Using Git and Tools
December 2, 2010
Global Settings
• Reasons to merge:
o merging branches
o Resolving conflicts when pushing
• Git attempts to auto-merge first
o Doesn't require a commit if succeeded
• Then manual merge
o use kdiff to merge between 2 or 3 sources
local, remote base, & remote head
o Requires commit & message
The Basics: Commit & Push
• Commit
• Push
o Your team doesn't know what you did until you push
changes to them!
Going back (revert & amend)
• Revert
– Go back to a specific revision
– “--hard” or “force” means that all current pending changes
will be lost
• Commit --amend
– Amend a past commit message
• Rebase interactive can be used to delete commits
Branching
• http://book.git-scm.com/4_rebasing.html
• Change the "base" of the branch to a newer version
o i.e. Making a change in production
Dev
branch
Prod patch
from an
escalation
Rebase
Rebase vs Merge
Rebase: Example
Cherry pick
• statistics
• bisect
o tracing where in commit history a test started to fail
• commit --amend
o For when you committed too soon
• branch & revert master
o if you decide down the line that you should have been
working on a separate branch, just do the branch and
reset master back to "origin/master"
• Auto-rename
• Git will understand when you renamed a file. There won’t
be “delete” & “create” operations, just one single rename
and history will be maintained. No commands necessary
Server: gitolite and SSH
• http://progit.org/book/
• In Git bash, help files open into browser
– Git --help
– Git <cmd> --help