New portion of Pro Git book…

Stashing
git stash – stashes current workspace
git stash list – shows all stashed snapshots
git stash apply stash@{n} [–index] – reverts workspace to stashed n-th state, if “–index” restores staged status
git stash branch <branch name> – creates a branch from a stash

Rewriting history
git commit –amend – edits last commit (like small rebasing), do not amend already pushed commits
It is also possible to change multiple commits, reorder commits, squash commits, split commits and make filter-branch

Debugging with git
git blame – L n1, n2 <file name> – shows who, when, why has changed source code from n1 to n2 line of file
git bisect – binary search for a bug

Advertisements

About DmitryKrinitsyn
Software developer and muay thai adept

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: