Tech Blog :: Drupal Dojo 9/29: Git workflows
Drupal Dojo 9/29: Git workflows
Learned tonight at the unofficial Drupal Dojo in JP (copied from BHirsch):
Helpful links about forking (w github)
http://help.github.com/forking/
http://help.github.com/pull-requests/Undo a local change to a specific file do:
(note this checkout trick only works with modified files, not new files)
$ git checkout filename
OR
$ git checkout path/to/fileNote: -- (double dash) separates all your options from the file path. E.g...
$ git command op1 op2 op3 -- path/to/fileUndo a committed change to a single file
$ git checkout 915108a7 -- filenameUndo all uncommitted local changes
$ git reset --hardUndo everything up to this point
$ git reset --hard thispoint
e.g...
$ git reset --hard HEAD
$ git reset --hard 915108a71552Undo a specific commit (only that one commit), use revert
$ git revert 915108a71552Undo a bunch of commits all at once...
$ git revert 915108a71..b05f9b935e29fd
Note: This (above) makes you log a message for each commit that is undone here, and each individual reversion is its own commit.Deleting a local branch (where example is the name of an example branch)
$ git branch example
$ git checkout example
$ git push origin example
$ git checkout master
$ git branch -D example # now local branch is deleted
$ git push origin :example # this deletes the branch from remoteUndo a bunch of commits all at once with a single commit...
$ git revert -n 915108a71..b05f9b935e29fd
$ git commit -m "this is the only message i need because it all gets done in one commit."
Google: TheBuckSt0p
Facebook: BenBuckman
LinkedIn
Github: newleafdigital
@thebuckst0p
Delicious: thebuckst0p
Drupal.org: thebuckst0p
Great cheatsheet for me, just dabbling in Git. Thanks!
Post new comment
Don't bother putting in spam links. They'll be set to
rel=nofollowand will be removed and reported as spam shortly after submitting.