I had been trying to learn more about Git, but honestly, git add
git commit
and git push
would be everything I would ever need and I just could not even find a file that is big enough to justify the use of all those Git commands until I began to use Vim.
If you are just like me, well, you can try to use Git to version control your vimrc file. For example, there are many ways you can install plugins, and if you are in the mood of trying some out and you don’t really want to mess up your vimrc file, you can create a new branch for it like git checkout -b plugin
and do whatever you like with your vimrc file. (You can also use this method to manage platform specific settings) If you are finally satisfied with the setup, you can git merge plugin master
(or just git merge plugin
) merging the content you wrote back into the master branch and if you don’t want to keep those changes, you can simply git checkout master
and you are back home now. After you begin to use branches, all other git commands would begin to make sense to you, too. For example, you can use git branch -v
to see available branches and what each of these branches does; git log --oneline --all --graph
to see all changes you have made; git fetch
to fetch changes you made and pushed from elsewhere and you will now begin to appreciate the difference between git fetch
and git pull
These are just a fraction of all the cool things you can do with git and if you want to learn more, Git Pro and the Missing Semester lecture on Git are both very useful.