Hi there,
I’m trying to delve deeper into git by playing with it on dummy repositories. However, I’m a newbie in using the terminal, and at times I don’t understand if it’s my lack of experience with it or with git that blocks me.
For example, today, I was trying the git rebase -i command, but I couldn’t understand how to format and use the message on the terminal:
Basically, I don’t know what I need to know; can someone point me in the right direction (git docs? terminal docs?) ? I’m on mac.
Have you looked up tutorials on git rebase? I use interactive rebase all the time, and ultimately I learned from Googling examples of how that syntax works.
Yes, I have.
It’s not the syntax that I don’t understand, it’s the ‘how to’.
So far I’ve discovered that to modify a line I need to press ‘a’, and then I can modify say, ‘pick’ into ‘drop’. But after that, how do I ‘fire’ the rebase action?
I’m sure I’m missing something trivial, probably something about how the terminal works…
Once you have modified the file, you save and exit and the rebase should happen automatically. How you save and exit depends upon the text editor you have as your default.
Hi @Marco16168 , welcome to the wonders of Vim: one of the oldest text editor, yet one of the most loved (and feared) one.
Why did vim open?
With git, certain command will require the usage of a text editor to modify certain elements. It just happens that vim is the default for many.
You don’t need to become a master in it, but you need to know a couple of commands to perform the bare minimum.
I suggest you to type vimtutor in your terminal, and follow the brief introduction.
There are a few situations like this one where Git will launch a default text editor. As @lasjorg pointed out, it’s worth figuring out how to make it use an editor that you like.
At some point, it’s a good idea to at least learn the bare basics of Vim because you’re likely to run into it from time to time, but if it’s blocking you from getting comfortable with Git, then just put it on a list for later.
Insert, save and quit is pretty much all I remember when I haven’t had to use Vim heavily in a while. But if I’m on a strange computer and Git opens Vim, those are the only commands I need anyway.
Hi Marco,
You can also refer to a great resource called Pro Git by [Scott Chacon & Ben Straub ]. Their book coverers Git fairly extensively. You can find it at Pro Git Book.
I hope it guides you as well as it has done for me.
You are welcome. I’m busy deep-diving into DVCS, specifically Git, Mercurial and one or two others that may be worthwhile learning. I find many interesting articles and references out there. So, if you need anything specific, let me know and I’ll pass on the related information I have on it.