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
Steve’s a Seattle-based entrepreneur and software leader and father of three. He’s American-Canadian, and east-coast born and raised. Steve has made the Pacific Northwest his home since 1991, when he moved here to work for Microsoft. He’s started and sold multiple Internet companies. Politically independent, he writes on occasion about city politics and national issues, and created voter-candidate matchmaker Align Vote in the 2019 and 2021 election cycles. He holds a BS in Applied Math (Computer Science) and Business from Carnegie Mellon University, a Masters in Computer Science from Stanford University in Symbolic and Heuristic Computation, and an MBA from the Harvard Business School, where he graduated a George F. Baker Scholar. Steve volunteers when time allows with Habitat for Humanity, University District Food Bank, Technology Access Foundation (TAF) and other organizations in Seattle.
read more