Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
View all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
Accelerator
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
Uh oh!
There was an error while loading.
Please reload this page
.
SQLab
/
PEaaS
Public
Notifications
You must be signed in to change notification settings
Fork
1
Star
0
Code
Issues
16
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Files
Expand file tree
master
Breadcrumbs
PEaaS
/
git_command_reference.txt
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
61 lines (58 loc) · 2.67 KB
master
Breadcrumbs
PEaaS
/
git_command_reference.txt
Copy path
Top
File metadata and controls
Code
Blame
61 lines (58 loc) · 2.67 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
Git 指令參考
1.git config
git config --global user.name "<Your name>"
git config --global user.email "<Your email>"
這個指令會設定Git的設定值。
第一次安裝完成之後,請務必設定自己的名字與信箱。
因為Git是利用名字與信箱來分辨貢獻者。
2.git clone <url>
這會指令會將url所指定的倉庫複製到目前目錄。
3.git add <filename>
這個指令會將filename所指定的檔案加入到倉庫追蹤當中。
如果檔案沒有先加入倉庫追蹤的話,Git是不會對該檔案進行版本管理。
4.git commit
這個指令會將有追蹤並且修改過的內容提交。
提交時Git會要求必須輸入修改的內容。
提交之後會有一個唯一識別號,可以透過這個識別號去查看之前的修改與說明。
5.git pull <origin> <master>
這個指令會將遠端的倉庫與本地的倉庫同步並合併。
(如果不是使用clone的話,需要先透過git remote add <url>先設定)
如果有衝突的話Git會要求解決衝突之後再commit。
6git status
檢視狀態,有任何不確定可隨時確認。
7.git log
檢視commit的歷史紀錄,一次只會顯示一條branch上的commit紀錄。
8.git remote add <origin> <url>
git push -u <origin> <master>
-u tells Git to remember the parameter, so that next time we can
simply run "git push".
9.git diff
顯示commit之間的不同處。相關參數可以參考git_real_slides.pdf
10.git blame <filename> --date short
追蹤一個檔案的修改紀錄
11.git reset HEAD <file.path>
將之前add進stage的檔案,重新拿出STAGE。
12.git checkout -- <filename>
將檔案回復到最後一次commit後的版本。
#注意!這之前的執行動作會全部消失。
13.branch 系列
git branch <branch.name>
創造一個<branchname>分支。
git branch
顯示現在有哪些分之。
git checkout <branch.name>
移動到<branch.name>這個分支。
git branch -d <branch.name>
刪除<branch.name>此分支。
git merge --no-ff <branch.name>
將<branch.name>此分支合併到當下所在的分支。
--no-ff參數會清楚記錄之前的分支操作步驟,較優。
參考資料:
1.http://blog.wu-boy.com/tag/git/
中文,簡單易懂,詳盡。
2.https://github.com/FreedomKnight/TagExpert/blob/master/doc/GitTutorial.md
中文,簡單易懂,執行git最基本的流程。
3.http://ncu-csie-snmg.github.io/2013-NCU-CSIE-Website-Design-Competition/git.html
中文,此篇的主要參考資料。
4.http://courseware.codeschool.com.s3.amazonaws.com/git_real_slides.pdf
簡報PDF,英文,有很多指令的參數可以從這找。
You can’t perform that action at this time.