You fix the bug.
You’re riding the high, having fixed a persistent bug that’s been bothering you for a week. Then you decide, why not, I’ll just code a little more. Nothing’s planned out but you decide to dive in anyway. You’re on a roll.
Three hours later your program won’t compile and you have no idea why.
You don’t have any configuration management set up. And you have no idea how to reverse your changes.
At best you can pull up an old zip file of the code from 1 month ago.
You’ve effectively ruined your code.
Now you’re tired. Now you’re angry. And worst of all you have to start over.
Enter Configuration Management
Configuration management is an elegant life-saving productivity monster.
Thoughts on Git
My biggest beef with git is that the terminology they use to describe the functions the program does seem like they could be better written. “Checkout” means “switch current branch.” It’s almost as big of a misnomer as the * character used in C to denote a dereferenced pointer.
Mental Mapping of Git verbs
- commit – save all changes and add a label
- branch – make a copy that doesn’t affect the original
- checkout – switch to branch/commit
- cherry-pick – choose the good copies and add it to the project (best git command ever)
- checkout – switch to this version of the project
- reset – act like this version never existed
- revert -act like this version never existed and add in everyone else’s changes
- rebase – cleanly merge the copy with the original file (Honestly, I still don’t really understand the big difference between rebase and merge other than the commit history looks cleaner. Comparing rebase to a clever helped but the exact differences between the rebase and merge is still unclear).
- merge -copy the original file with the changes in the copy.
Areas of Improvement
This interactive git tutorial highlights my weaknesses in the following areas of git:
- rebase -i
Comparing Configuration Management solutions
Compared to RCS, CVS, Subversion, and Mercurial, Git has a decentralized approach to configuration management. Users can copy the entire codebase to their computer. Once their changes are made, they can either keep working on their own copy of the project or they can submit their changes back to the original copy of the project.
Git facilitates the three prime directives of open source software:
- The README.md file explains the usefulness of the project.
- The entire codebase is included as a downloadable compressed file (so it can be used installed and used by the user).
- The entire codebase is made available to the user so they can see how everything inter-operates and update the code themselves.
Thoughts on Github
I created a sample repo on my new GitHub profile page: HelloRepo I am impressed that GitHub has the ability to programmatically create a compelling webpage to showcase the development of open source projects for developers. Here’s a link to the page that was automatically generated by GitHub for my repo: http://davidkneely.github.io/HelloRepo
GitHub has an interactive git tutorial that shows users how to use git from the command line with a simulated command line in the browser. It reminded me of the programming interface on Codecademy. I have one comment to add on the fantastic tutorial. On the interactive git tutorial, specifically on the rebase tutorial, keep in mind that the pick buttons that are highlighted pink mean they are “already selected.” I got stuck for a good 15 minutes because of this misapprehension of the interactive interface.
GitHub app for Mac
I download the GitHub app. The GitHub app is the easiest way to interact with Github. I used the first version back in 2011 and it was awful. I am glad to see that it’s gotten much better and doesn’t crash. New users who want to quickly interact with their repositories on GitHub should use the GitHub app if they are visual learners.
How do you undo your last git command? I found an answer on StackOverflow on how to undo the last commit but I want to know now if it is possible to undo any git command, not just a commit. If you know how to do this, please email me.
Ok, I think I got it, reset and revert allow you to go back in commits but the commits stay there in the git hierarchy. I am interested in a way to remove previous commits from the git hierarchy. I will keep researching.