I'm new to git and I'm trying to commit my first changes on a Windows machine. However, when I type in $git commit
it takes me to a different screen than any online tutorials show or than what is mentioned in Pro Git. No online searching yields an explanation of how to use this screen, either.
The screen looks like this:
I have tried every key on the keyboard, but nothing seems to actually do the commit. Also there are all these little help options in green at the bottom of the screen that seem to be giving commands, but when I press the buttons they show it just types them into the commit message. What are those help options and how do I use them?
Everyone else seems to be using something called "vim" which I believe I chose not to install when installing Git because I thought the Windows console was fine.
So how do I actually commit and what are those green commands at the bottom of the screen? Thanks!
If you are using nano : Press Control+O (the letter, not 0 the number), then Enter to save the message. Then, press Control+X to exit.
There are many ways to rewrite history with git. Use git commit --amend to change your latest log message. Use git commit --amend to make modifications to the most recent commit. Use git rebase to combine commits and modify history of a branch.
You can modify the most recent commit in the same branch by running git commit --amend. This command is convenient for adding new or updated files to the previous commit. It is also a simple way to edit or add comments to the previous commit. Use git commit --amend to modify the most recent commit.
Commit has not been pushed online On the command line, navigate to the repository that contains the commit you want to amend. Type git commit --amend and press Enter. In your text editor, edit the commit message, and save the commit.
That screen is just a text editor and those options at the bottom, represent commands, tipically its the ctrl
key + the letter for the command.
To make the commit you should write your commit message, then press ctrl+o
to write your message, and then ctrl+x
to exit that screen.
To avoid that screen you could do something like git commit -m 'your commit message'
, the -m
indicates that your commit message goes in the command.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With