search
HomeDevelopment ToolsVSCodeIntroduction to using Git in VSCode
Introduction to using Git in VSCodeJan 26, 2021 pm 06:32 PM
gitvscode

This article will introduce to you how to use Git in VSCode. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.

Introduction to using Git in VSCode

Related recommendations: "vscode Basic Tutorial"

The most convenient thing about using git is to write it in the company, for example After a lot of code, you can open vscode when you get home and just click pull to synchronize everything. Isn't it very convenient? . . . After all, I used to take a USB copy home or save it to a cloud disk and then download it. .

What I use here is the code hosted by the domestic code cloud, and github cannot understand English. .

Because vscode has a git management function, you only need to learn a little bit of operational knowledge about git.

You need to download ‘msysgit’ on the homepage and install it on your computer, otherwise git in vscode will not work. After the installation is complete, you will mainly use the Git Bash program to operate

1. Put the code into Code Cloud

  • Create a new warehouse in Code Cloud. After completion, Code Cloud will have a command Just follow the tutorial above.
  • Usage tutorial in Code Cloud:
-- user.name  
git config -- user.email -m git push -?git push -u origin master

Here are the detailed local operation steps:

  • 1. Open your project folder with vs

  • 2. Configure git

 Open Git Bash and enter the following command

If you haven’t entered the global configuration yet, enter the global configuration first

Git 全局设置:

git config --global user.name "ASxx" git config --global user.email "123456789@qq.com"

Then start configuring the code submission to the code cloud

cd d:/wamp/www/mall360/wap              //首先指定到你的项目目录下
git init
touch README.md
git add README.md
git commit -m "first commit"

Under normal circumstances, after the above command is executed, there will be a hidden .git folder in the local folder, and there should be a README.md file in your warehouse in the cloud.

  • 3. Submit the code to the warehouse in vscode

Go back to vscode and open the git workspace and you will see all the codes displayed here.

Click the number to submit all files to the temporary storage area.

Then open the menu and select--Submit the temporarily saved

Then follow the prompts to enter a message in the message box, and then press ctrl enter to submit

Then push all the temporarily stored codes to the cloud.

After clicking, a pop-up will pop up asking you to enter your account password. Just enter your hosting platform account and password. . .

If there is no problem, your entire project will be submitted to the cloud.

Every time you update the code in vs, you will need to enter the account password. For convenience, you can configure it to let GIT remember the password account.

git config --global credential.helper store   //在Git Bash输入这个命令就可以了
  • 4. Synchronization code

Here we talk about the use of modifying the code and submitting it to the cloud, and the local code and the cloud Synchronization

Open a file and add a comment

You can see that there is a prompt on the git icon, and you can see it when you open the git workspace Modify this file

# and then click the number on the right to temporarily save it.

Enter the message in the message box and press ctrl enter to submit the temporary save

Then click push to submit, and the code will be submitted to the cloud.

You can see it by opening the code cloud. .

  • pull use

For example, when you modify the code at home and submit it to the cloud, you only need to open it with vscode when you return to the company The project can be synchronized by clicking pull in the menu.

  • 5. Clone your project locally

 After returning home What should I do if I want to modify the code but there is no file on my computer? Look down

  首先你电脑还是的有vscode 和  GIT,,然后用git把上面那些全局配置再执行一次,如下

git config --global user.name "ASxx"git config --global user.email "123456789@qq.com"  git config --global credential.helper store

  然后打开Git Bash输入以下命令

cd d:/test   //指定存放的目录
git clone https://git.oschina.net/name/test.git   //你的仓库地址

下载成功,然后就可以用vscode打开项目修改了,修改后提交的步骤还是和上面一样:暂存-提交暂存-push提交到云端就ok了。

更多编程相关知识,请访问:编程教学!!

The above is the detailed content of Introduction to using Git in VSCode. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:博客园. If there is any infringement, please contact admin@php.cn delete
手把手带你会习VSCode debug,不信你还不会!手把手带你会习VSCode debug,不信你还不会!Mar 31, 2022 pm 08:45 PM

2022年了,该学会用VSCode debug了!下面本篇文章手把手带大家会习VSCode debug,希望对大家有所帮助!

浅析VSCode怎么关闭自动更新浅析VSCode怎么关闭自动更新Jun 02, 2022 pm 12:56 PM

VSCode怎么关闭自动更新?下面本篇文章给大家介绍一下VSCode关闭自动更新的方法,希望对大家有所帮助!

手把手带你在VSCode中配置 Geant4 和 Root手把手带你在VSCode中配置 Geant4 和 RootApr 25, 2022 pm 08:57 PM

本篇是VSCode配置文章,手把手教大家怎么在VSCode​中配置使用 Geant4 和 Root,希望对大家有所帮助!

23个提高开发效率的前端VSCode插件(快来收藏)23个提高开发效率的前端VSCode插件(快来收藏)Jul 25, 2022 pm 08:06 PM

本篇文章给大家分享23个前端VSCode插件,助你提高开发效率,让你事半功倍,快来收藏吧!

扒一扒vscode Prettier选项中的16个实用属性,让代码变美!扒一扒vscode Prettier选项中的16个实用属性,让代码变美!May 03, 2022 am 10:00 AM

本篇文章扒拉一下vscode Prettier的选项,总结分享16个让你的代码变漂亮的属性,希望对大家有所帮助!

总结分享12个好玩有趣的 VSCODE 插件总结分享12个好玩有趣的 VSCODE 插件May 27, 2022 am 11:06 AM

“工欲善其事,必先利其器!”,vscode作为前端开发的重要工具,其插件能大幅提升战斗力,精心收集12个插件,总有几款你还未曾拥有。

VSCode中如何开发uni-app?(教程分享)VSCode中如何开发uni-app?(教程分享)May 13, 2022 pm 08:11 PM

VSCode中如何开发uni-app?下面本篇文章给大家分享一下VSCode中开发uni-app的教程,这可能是最好、最详细的教程了。快来看看!

手把手教你在VScode中配置C/C++环境(Win下)手把手教你在VScode中配置C/C++环境(Win下)Oct 10, 2022 pm 06:52 PM

VScode中怎么开发置C/C++?怎么配置C/C++环境?下面本篇文章给大家分享一下Windows系统下VScode配置C/C++环境图文教程,希望对大家有所帮助!

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment