Using Git to manage your code? We all know about git init, commit, etc. But here are some handy git commands for common scenarios:

Clone from GitHub

git clone {github url}

Unlink your Local Repo from GitHub

Ever want to use an example app on GitHub as a starting point for your application or component, and want to unlink it from the original GitHub address?

This can be done in two steps:

git remote rm origin

This will delete the config settings from .git/config.

Then, issue

rm .git/FETCH_HEAD

to get rid of the FETCH_HEAD, which still points to GitHub.

Help with the Most Common Git Commands

git help everyday

Search your Change Log

Where was that checkin that I did which altered the “foo” class? 

git log -S foo

List all Conflicting Files

git diff --name-only --diff-filter=U

Reword the Previous Commit Message

git commit -v --amend

Write A Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.