[Git] Pushing Local Commits to GitHub Repository Remotely via Git Commands in VS Code(透過 Git 命令將本地update遠端推送到 GitHub Repository)

SDE Simple Technique

LH
eic's Tech/Travel/Study Logs
2 min readJun 10, 2024

--

Git Commands

Git command is very useful in daily development works! Here is some explanations of git commands from ByteByteGo.com

ByteByteGo.com has a great explanation (ByteByteGo.com 的解釋超好)

Navigator(導航)

1. Select files you want to push to GitHub (添加特定文件):

If you want to push specific files (e.g., ‘src’ and ‘temp’ files) from your local repository to GitHub using VS Code, while excluding other files, you can follow these commands in your VS Code terminal:

如果您只想將本地庫中的特定文件(例如 ‘src’ 和 ‘temp’ 文件)推送到 GitHub,而不包括其他文件,可以按照以下在 VS Code 終端中輸入的命令:

git add src temp

If the files are located in different directories, specify their paths accordingly:

如果文件位於不同的目錄中,可以相應地指定其路徑:

git add src test/data

If you want to select all files, you can use the following command:

如果您想添加所有文件,可以使用以下命令:

git add .

2. Make your commit message describing the changes for records (提交維護項目的信息)

Commit messages can help maintain the project’s history and make it easier for others to understand the context of changes.

提交信息可以幫助維護項目的歷史記錄,讓其他人更容易理解更改的背景。

git commit -m "Commit Create"

3. Push the changes to the main branch on GitHub (將更改推送到 GitHub 上的 main 分支):

git push origin main
Finished(完成)!

I hope my blog helps make your development process smoother!

希望我的博客能幫助您順利開發!

--

--