For the past 2 days, I’ve been using Git exclusively from the command line, and I’ve learned an awful lot! The funny thing is that I’m only using it from the command line because I don’t have admin access to install new software (namely SourceTree for visual Git management) on my work computer.
The main reason I’ve been using Git at all is that my company has been using SVN for its source control management since about 2010. While SVN is perfectly fine, Git is the new industry standard and also just happens to be what I know best. Not that I knew it very well, but I certainly knew it better than SVN. Here’s an article with a misleading title that helped me finally understand the differences between the two: Switching from Subversion to Git. I’ve talked with my coworker about switching to Git, and he seemed eager to try it out. So during a slow spell for me yesterday, I figured I’d look into converting our giant SVN repository to Git.
After searching a bit, I happened upon this article: Convert Subversion to Git, and BOY was it helpful! Everything went as the article said (minus a couple of slight changes since I’m on a Windows machine), and after about an hour and a half, I had a completely functional Git repository with all the history of the SVN repository! I still need to teach everyone involved with the code how to use Git, but that’s a small hurdle to overcome after all this work!
After the conversion finished, I was encouraged to start converting other projects that I’ve been working on to Git (actually, the big project I’ve been working on for a while has already been using Git, I just wanted to start converting more). That’s when I learned about Git submodules, and my workflow was revolutionized! Now I can make references to other projects and get everything connected as efficiently as possible! It was very exciting for me.
I also learned more about the basics of using Git from the command line, and I can now crawl my projects using the command line and Git like something better than a complete newbie! My favorite thing that I learned is the difference between git log
and git show
:
git log
will show a log of all the commit messages that were made in a scrollable format, whilegit show
shows the diff of the most recent commit so you can see what was changed! You can use both commands in conjunction with each other by usinggit log
to find a particular commit id andgit log <commit>
to show the diff for that commit!
Very useful, especially since I thought the only way to view changes was with a Git UI like SourceTree. Granted, I’ll still use SourceTree when I can, but now I feel confident that I can use Git effectively on a machine without it installed.
After all this work and learning, I now have a new Repository folder where all the Git repos live, and we can start working like modern programmers here at work! Hooray!