search
HomeDevelopment ToolsVSCodeIntroduction to using Git in VSCode

Introduction to using Git in VSCode

Jan 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
How to back up vscode settings and extensionsHow to back up vscode settings and extensionsApr 15, 2025 pm 05:18 PM

How to back up VS Code configurations and extensions? Manually backup the settings file: Copy the key JSON files (settings.json, keybindings.json, extensions.json) to a safe location. Take advantage of VS Code synchronization: enable synchronization with your GitHub account to automatically back up all relevant settings and extensions. Use third-party tools: Back up configurations with reliable tools and provide richer features such as version control and incremental backups.

How to build vscodeHow to build vscodeApr 15, 2025 pm 05:15 PM

By carefully building a Visual Studio Code (VS Code) development environment, programmers can greatly improve development efficiency. Key steps include: Selecting practical and stable extensions, such as Prettier, ESLint, and Python extensions. Use the workspace to set up a personalized editor to customize configurations for different projects. Master debugging skills and quickly locate and fix code errors. Choose a comfortable theme and appearance to enhance the development experience. Continue to learn and improve, and constantly explore ways to improve efficiency.

How to change the background color of vscodeHow to change the background color of vscodeApr 15, 2025 pm 05:12 PM

How to personalize your VS Code theme? Beyond simple background colors: choose the right theme, customize the color scheme, improve code readability and debugging efficiency. Advanced settings: Adjust fonts, formatting, code snippets and shortcut keys to create an exclusive workspace to improve coding speed and efficiency. Practice and debugging tips: Solve common problems (such as code highlighting and font blur), optimize settings to meet specific project needs.

How to beautify vscodeHow to beautify vscodeApr 15, 2025 pm 05:09 PM

To make VS Code shine, you need: Beautify the interface: Choose pleasing themes and icons such as One Dark Pro theme and Material Icon Theme. Improve encoding speed: Use code snippet extensions to speed up encoding, such as ES7 React/Redux/React-Native snippets, and create custom code snippets. Efficient version control: Proficient in using VS Code's Git integration, and use the Git command line tools to solve complex problems when necessary. Quickly locate problems: master the debugger, correctly set breakpoints and start programs, and shorten debugging time. Extension management: select only the extensions you really need

How to beautify json with vscodeHow to beautify json with vscodeApr 15, 2025 pm 05:06 PM

Beautifying JSON data in VS Code can be achieved by using the Prettier extension to automatically format JSON files so that key-value pairs are arranged neatly and indented clearly. Configure Prettier formatting rules as needed, such as indentation size, line breaking method, etc. Use the JSON Schema Validator extension to verify the validity of JSON files to ensure data integrity and consistency.

How to build vscode cHow to build vscode cApr 15, 2025 pm 05:03 PM

VS Code provides a powerful C development environment that improves development efficiency. When configuring, you need to pay attention to path issues, memory leaks and dependency management. Advantages include extended ecosystems, excellent code editing capabilities, and integrated debuggers, while disadvantages are extended dependencies and resource consumption.

How to change vscode fontsHow to change vscode fontsApr 15, 2025 pm 05:00 PM

Customizing fonts in VS Code can improve the coding experience. Selecting the right font, such as Consolas, Fira Code, or Source Code Pro, can improve readability. Setting the font includes modifying the font name, size, and line height. Avoid common pitfalls such as font rendering issues, special character displays, and font conflicts. Advanced tips include using code snippets and choosing a coordinated topic to further enhance readability and aesthetics. By customizing fonts, you can create a comfortable and efficient coding environment.

How to check the vscode versionHow to check the vscode versionApr 15, 2025 pm 04:57 PM

You can determine your VS Code version number in the following ways: "About" menu: In the menu bar, select "Help" > "About", and the version number will be displayed in the pop-up window. Command panel: Press Ctrl Shift P (Windows/Linux) or Cmd Shift P (macOS), enter "about" or "version" to select the option to display version information. package.json file: Locate the package.json file in the installation directory of VS Code, which contains version information.

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)
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version