JIYIK CN >

Current Location:Home > Learning > OPERATING SYSTEM > Git >

Close the Git commit editor on Windows

Author:JIYIK Last Updated:2025/03/31 Views:

In this article, we will discuss how to exit the Git commit editor. This can be a little tricky, especially if you are new to Git bash .

Let's see how to exit the editor on Windows.


Close the Git commit editor on Windows

We will look at a typical commit flow on Git to make it easier to understand. From the example below, we can see several untracked files we have by running the git status command.

pc@JOHN MINGW64 ~/Documents/GitHub/Delftscopetech (main)
$ git status
On branch main
Your branch is ahead of 'origin/main' by 3 commits.
  (use "git push" to publish your local commits)
Untracked files:
  (use "git add <file>..." to include in what will be committed)
        .gitignore~
        Example Code 2
        Example Code 2.php
        Example Code 3.php
        Example code 1.php
        downloadpdf.php
        htmllinkpdf.html
nothing added to commit but untracked files present (use "git add" to track)

Let's add the downloadpdf.php file and commit the changes. We run the following code to add it:

$ git add downloadpdf.php

To commit, we run the following command:

$ git commit

After running the git commit command, the commit editor will pop up as shown below:

Exit the git commit message editor 1

Follow these steps to save your commits and exit the editor.

  1. A newly opened editor is usually in normal mode. Use to iswitch to insert mode.
  2. On the first line, write your commit message, then press the escape key to switch back to normal mode.
  3. Type :wq to save and exit the editor.Exit the git commit message editor 2
  4. Press Enter to return to the normal terminal window.Exit the git commit message editor 3

Exiting an editor on Windows is as simple as that. This method works for both vi and vim editors.

For users using the Emacs editor, use Ctrl+X Ctrl+S to save, and Ctrl+X Ctrl+C to exit the editor.

Previous:Changing drives in Git Bash

Next: None

For reprinting, please send an email to 1244347461@qq.com for approval. After obtaining the author's consent, kindly include the source as a link.

Article URL:

Related Articles

Changing drives in Git Bash

Publish Date:2025/03/30 Views:57 Category:Git

This short article will discuss how we can use Git Bash to have a Unix-style command line environment in Windows operating system and run multiple commands in this terminal. Git Bash Git is a collection of command-line utilities created to

Adding a remote branch in Git

Publish Date:2025/03/30 Views:142 Category:Git

Git does not allow its developers to create new branches on remote repositories. But instead, we can push an already existing local branch, and after doing so, we can bring it to the remote repository using some Git commands. In every versi

Synchronize your local repository with a remote repository in Git

Publish Date:2025/03/30 Views:92 Category:Git

This article outlines the process of syncing your local repository with a remote repository. We will also see how to sync a GitHub branch with a remote repository on the command line. Synchronize your local repository with a remote reposito

Creating a remote repository from a local repository in Git

Publish Date:2025/03/30 Views:106 Category:Git

This article discusses the necessary steps to create a remote repository based on a local repository. This is ideal when you have a local repository that needs to be available on a remote or SSH-enabled server. Creating a remote repository

Removing the upstream repository in Git

Publish Date:2025/03/30 Views:177 Category:Git

This article will teach you how to delete an upstream repository in Git. We may sometimes need to delete or change the remote repository that we use with our local repository. To do this, we can use the Git command git remote . Removing the

Git remote add SSH

Publish Date:2025/03/30 Views:53 Category:Git

In this day and age, the most widely used version control system is Git, which is operated by most developers within a team structure. This is mainly used to increase code efficiency, no matter how big or critical the project is. In this se

Differences between Git Reset, Revert and Checkout commands

Publish Date:2025/03/30 Views:186 Category:Git

This article discusses the differences between the git reset , , git revert and git checkout commands. These are some of the most useful Git utilities that allow us to undo certain changes in our repository. It’s easy to get confused with

Git revert local commits

Publish Date:2025/03/30 Views:85 Category:Git

When a software engineer or a web developer uses Git, it is obvious that he pushes a lot of code and commits to the Git repository every day, and while doing so, the need to undo or revert a particular commit or a set of commits arises from

Deleting local and remote Git branches

Publish Date:2025/03/30 Views:147 Category:Git

Git comes into play in version control systems when you are working with a team and the entire team is making changes to the same code repository. Creating a new branch in Git is relatively easy than other version control systems and deleti

Scan to Read All Tech Tutorials

Social Media
  • https://www.github.com/onmpw
  • qq:1244347461

Recommended

Tags

Scan the Code
Easier Access Tutorial