将现有文件夹推送到 GitLab
Push existing folder to GitLab
在 Gitlab 项目的说明中,他们讲述了如何将 existing_folder 添加到 Git 存储库。
但是在我按下 git commit
之后,控制台打开 vim.
那我怎么去最后一个git push -u origin master
然后把我的仓库push到gitlab
cd existing_folder
git init
git remote add origin [remote url]
git add .
git commit
git push -u origin master
更改 git 提交到
git commit -m "insert commit message here"
-m
标志将您在引号中输入的内容添加为提交消息。 vim 打开,因为消息丢失。
命令 git commit
启动您的默认命令行文本编辑器,因为提交需要一条消息来描述其中发生的事情。添加此消息有两种方式:
- 启动编辑器 (vim) 时,在编辑器中写入提交消息,然后保存并关闭文件。此消息现在将与提交一起存储。退出而不保存文件将取消提交。
- 使用命令
git commmit -m "Commit message here"
,它允许您在不启动编辑器的情况下在引号中添加简短的提交消息。
提交消息可以是任何内容,但 here is an article if you want to go in depth on what should be in a message and how to format it。有时我使用全文编辑器来编写复杂的消息,有时我只需要快速注释并使用带有 -m
标志的内联命令。
想要更改 git 用于提交消息的默认编辑器?你很幸运!只需将它添加到您的 git 配置中,如下所示:git config --global core.editor "nano"
。现在提交消息将以 nano 或您在此配置命令中输入的任何编辑器命令打开。
在 Gitlab 项目的说明中,他们讲述了如何将 existing_folder 添加到 Git 存储库。
但是在我按下 git commit
之后,控制台打开 vim.
那我怎么去最后一个git push -u origin master
然后把我的仓库push到gitlab
cd existing_folder
git init
git remote add origin [remote url]
git add .
git commit
git push -u origin master
更改 git 提交到
git commit -m "insert commit message here"
-m
标志将您在引号中输入的内容添加为提交消息。 vim 打开,因为消息丢失。
命令 git commit
启动您的默认命令行文本编辑器,因为提交需要一条消息来描述其中发生的事情。添加此消息有两种方式:
- 启动编辑器 (vim) 时,在编辑器中写入提交消息,然后保存并关闭文件。此消息现在将与提交一起存储。退出而不保存文件将取消提交。
- 使用命令
git commmit -m "Commit message here"
,它允许您在不启动编辑器的情况下在引号中添加简短的提交消息。
提交消息可以是任何内容,但 here is an article if you want to go in depth on what should be in a message and how to format it。有时我使用全文编辑器来编写复杂的消息,有时我只需要快速注释并使用带有 -m
标志的内联命令。
想要更改 git 用于提交消息的默认编辑器?你很幸运!只需将它添加到您的 git 配置中,如下所示:git config --global core.editor "nano"
。现在提交消息将以 nano 或您在此配置命令中输入的任何编辑器命令打开。