# Git and the terminal

**URL:** <https://forum.freecodecamp.org/t/git-and-the-terminal/472137>\
**Category:** General\
**Created:** [August 3, 2021, 11:07am UTC](https://forum.freecodecamp.org/t/git-and-the-terminal/472137 "2021-08-03T11:07:14Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marco16168](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/marco16168/32/234201_2.png) [@Marco16168](https://forum.freecodecamp.org/u/Marco16168)\
**Post date:** [August 3, 2021, 11:07am UTC](https://forum.freecodecamp.org/t/git-and-the-terminal/472137/1 "2021-08-03T11:07:14Z")

</div>

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:

![Screen Shot 2021-08-03 at 12.22.29](https://global.discourse-cdn.com/freecodecamp/original/3X/7/9/7946297661e7c9a39880af5843388fcfacbd49eb.png)

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.

Thank you

---

<div class="post-metadata">

**Author:** ![JeremyLT](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jeremylt/32/291894_2.png) [@JeremyLT](https://forum.freecodecamp.org/u/JeremyLT)\
**Post date:** [August 3, 2021, 1:25pm UTC](https://forum.freecodecamp.org/t/git-and-the-terminal/472137/2 "2021-08-03T13:25:37Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Marco16168](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/marco16168/32/234201_2.png) [@Marco16168](https://forum.freecodecamp.org/u/Marco16168)\
**Post date:** [August 3, 2021, 1:51pm UTC](https://forum.freecodecamp.org/t/git-and-the-terminal/472137/3 "2021-08-03T13:51:26Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![JeremyLT](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jeremylt/32/291894_2.png) [@JeremyLT](https://forum.freecodecamp.org/u/JeremyLT)\
**Post date:** [August 3, 2021, 1:59pm UTC](https://forum.freecodecamp.org/t/git-and-the-terminal/472137/4 "2021-08-03T13:59:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Marmiz](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/marmiz/32/74845_2.png) [@Marmiz](https://forum.freecodecamp.org/u/Marmiz)\
**Post date:** [August 3, 2021, 2:16pm UTC](https://forum.freecodecamp.org/t/git-and-the-terminal/472137/5 "2021-08-03T14:16:08Z")

</div>

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.

 ![image](https://global.discourse-cdn.com/freecodecamp/original/3X/2/7/27d58225f52536b13cdb43c96ad5dd7220223a85.png)

Have fun exploring the “mouseless” editor. 🙂

Edit: forgot to mention that you can of course change the default editor that git opens with:

```auto
$ git config --global core.editor [editor]

```

---

<div class="post-metadata">

**Author:** ![Marco16168](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/marco16168/32/234201_2.png) [@Marco16168](https://forum.freecodecamp.org/u/Marco16168)\
**Post date:** [August 3, 2021, 2:25pm UTC](https://forum.freecodecamp.org/t/git-and-the-terminal/472137/6 "2021-08-03T14:25:17Z")

</div>

All right, thanks. That was what I was missing I guess.

---

<div class="post-metadata">

**Author:** ![Marco16168](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/marco16168/32/234201_2.png) [@Marco16168](https://forum.freecodecamp.org/u/Marco16168)\
**Post date:** [August 3, 2021, 2:27pm UTC](https://forum.freecodecamp.org/t/git-and-the-terminal/472137/7 "2021-08-03T14:27:39Z")

</div>

> [@Marmiz](#):
>
> I suggest you to type `vimtutor` in your terminal, and follow the brief introduction.

Thank you! I will.

> [@Marmiz](#):
>
> ![image](https://global.discourse-cdn.com/freecodecamp/original/3X/2/7/27d58225f52536b13cdb43c96ad5dd7220223a85.png)

This is brilliant 😂 😂 😂 , I can totally relate

---

<div class="post-metadata">

**Author:** ![lasjorg](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/lasjorg/32/280761_2.png) [@lasjorg](https://forum.freecodecamp.org/u/lasjorg)\
**Post date:** [August 3, 2021, 2:47pm UTC](https://forum.freecodecamp.org/t/git-and-the-terminal/472137/8 "2021-08-03T14:47:37Z")

</div>

I would suggest [configuring git](https://git-scm.com/book/en/v2/Appendix-C%3A-Git-Commands-Setup-and-Config) to use the editor you use for coding.

For example VS Code: `git config --global core.editor "code --wait"`

---

<div class="post-metadata">

**Author:** ![ArielLeslie](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/arielleslie/32/264841_2.png) [@ArielLeslie](https://forum.freecodecamp.org/u/ArielLeslie)\
**Post date:** [August 3, 2021, 3:34pm UTC](https://forum.freecodecamp.org/t/git-and-the-terminal/472137/9 "2021-08-03T15:34:46Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![lasjorg](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/lasjorg/32/280761_2.png) [@lasjorg](https://forum.freecodecamp.org/u/lasjorg)\
**Post date:** [August 3, 2021, 3:46pm UTC](https://forum.freecodecamp.org/t/git-and-the-terminal/472137/10 "2021-08-03T15:46:20Z")

</div>

Well, at least know `:wq` if nothing else.

I never took the time to really learn VIM so that is about as much as I know, how to GT\*O.

---

<div class="post-metadata">

**Author:** ![ArielLeslie](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/arielleslie/32/264841_2.png) [@ArielLeslie](https://forum.freecodecamp.org/u/ArielLeslie)\
**Post date:** [August 3, 2021, 4:36pm UTC](https://forum.freecodecamp.org/t/git-and-the-terminal/472137/11 "2021-08-03T16:36:38Z")

</div>

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. 🤷‍♀️

---

<div class="post-metadata">

**Author:** ![Marco16168](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/marco16168/32/234201_2.png) [@Marco16168](https://forum.freecodecamp.org/u/Marco16168)\
**Post date:** [August 3, 2021, 6:43pm UTC](https://forum.freecodecamp.org/t/git-and-the-terminal/472137/12 "2021-08-03T18:43:43Z")

</div>

Thank you @JeremyLT and @ArielLeslie.  
What tricked me was that I didn’t realize that I was actually on Vim, hence my complete cluelessness.

---

<div class="post-metadata">

**Author:** ![RedRagon](https://avatars.discourse-cdn.com/v4/letter/r/48db29/32.png) [@RedRagon](https://forum.freecodecamp.org/u/RedRagon)\
**Post date:** [August 7, 2021, 4:59pm UTC](https://forum.freecodecamp.org/t/git-and-the-terminal/472137/13 "2021-08-07T16:59:21Z")

</div>

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](http://git-scm.com/doc).

I hope it guides you as well as it has done for me.

---

<div class="post-metadata">

**Author:** ![Marco16168](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/marco16168/32/234201_2.png) [@Marco16168](https://forum.freecodecamp.org/u/Marco16168)\
**Post date:** [August 8, 2021, 9:36pm UTC](https://forum.freecodecamp.org/t/git-and-the-terminal/472137/14 "2021-08-08T21:36:59Z")

</div>

Thank you @RedRagon,  
it looks like a more approachable, yet comprehensive alternative to the official reference.  
Happy coding!

---

<div class="post-metadata">

**Author:** ![RedRagon](https://avatars.discourse-cdn.com/v4/letter/r/48db29/32.png) [@RedRagon](https://forum.freecodecamp.org/u/RedRagon)\
**Post date:** [August 9, 2021, 4:29pm UTC](https://forum.freecodecamp.org/t/git-and-the-terminal/472137/15 "2021-08-09T16:29:54Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Marco16168](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/marco16168/32/234201_2.png) [@Marco16168](https://forum.freecodecamp.org/u/Marco16168)\
**Post date:** [August 11, 2021, 2:11pm UTC](https://forum.freecodecamp.org/t/git-and-the-terminal/472137/16 "2021-08-11T14:11:32Z")

</div>

Thanks, I will.  
That’s very kind of you.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/freecodecamp/original/3X/e/1/e1c433102e34b46dfaa3e15d13ab9a514b127078.svg) [@system](https://forum.freecodecamp.org/u/system)\
**Post date:** [February 10, 2022, 2:11am UTC](https://forum.freecodecamp.org/t/git-and-the-terminal/472137/17 "2022-02-10T02:11:39Z")

</div>

Closed on February 10, 2022, 2:11am UTC

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
