Showing posts with label commit. Show all posts
Showing posts with label commit. Show all posts

Sunday, April 11, 2010

Recover deleted branches in Git

Accidentally deleted a branch? No problem. Git reflog to the rescue.

git checkout -b recover_lost_commits

git reflog

e9c17db... HEAD@{0}: checkout: moving from stable to master
e9c17db... HEAD@{1}: checkout: moving from stable to e9c17dbfffd79f2bf30530e144c43c0f47322826^0
318c0f2... HEAD@{2}: checkout: moving from master to stable
e9c17db... HEAD@{3}: commit: Forgot to add images to CSS and adjusted positions.
3baab51... HEAD@{4}: commit: Added new buttons.

git merge e9c17db
Awesomeness.

Thursday, October 8, 2009

Insert Pivotal Tracker story id into Git commit messages


# Story id of feature from Pivotal Tracker is in feature file
# Example: features/course_management/admin_deletes_course.feature
# http://www.pivotaltracker.com/story/show/1423733
@ok
Feature: Admin Deletes Course
In order to manage course as a resource
As the admin
I should be able to delete a course

# Using head and sed to insert story id into commit message
git commit -am "[#`head -n 1 features/course_management/admin_deletes_course.feature | sed 's/.*\///'`] Replacing button ids to confirm to convention."