工作流
这是一个Git极简工作流,对于刚刚上手Git的小伙伴很实用。
- 下载代码(clone):
git clone <your-repo-url>
- 创建分支(branch):
git checkout -b dev
- 修改代码(CRUD):
vim file1; touch file2
- 查看状态:
git status -s
- 添加到暂存区或删除:
git add <file or directory>; git rm <file>; git rm -r <directory>
- 提交代码(commit):
git commit -m "commit msg"
- 推送代码(push):
git push origin HEAD:main
除此之外,还有2条命令,和Git修改代码无关,只想看看谁在修改代码,修改了哪些代码,可以通过下面的命令实现(高亮部分):
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
|
## show history
$ git log --name-status
commit baa818089f9721eba6b10f4326e0c25d0ce1cf33 (HEAD -> main, origin/main, origin/HEAD)
Author: ticktechman <geek.wystan@gmail.com>
Date: 2024-04-03 19:46:27 +0800
DS_Store
M mac-defaults.sh
## show details of one commit
$ git show baa818089f9721eba6b10f4326e0c25d0ce1cf33
commit baa818089f9721eba6b10f4326e0c25d0ce1cf33 (HEAD -> main, origin/main, origin/HEAD)
Author: ticktechman <geek.wystan@gmail.com>
Date: 2024-04-03 19:46:27 +0800
DS_Store
diff --git a/mac-defaults.sh b/mac-defaults.sh
index 3070b28..19bdb8c 100644
--- a/mac-defaults.sh
+++ b/mac-defaults.sh
@@ -213,6 +213,12 @@ function defaults.finder.set() {
## don't show recent tags in sidebar
defaults write com.apple.finder ShowRecentTags -bool false
+ ## don't write .DS_Store file on network volumns
+ defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
+
+ ## don't write .DS_Store file on local volumns
+ defaults write com.apple.desktopservices DSDontWriteLocalDotFiles true
+
## change list view font & icon size
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:ExtendedListViewSettingsV2:textSize 14" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:ExtendedListViewSettingsV2:iconSize 32" ~/Library/Preferences/com.apple.finder.plist
|
## show history
$ git log --name-status
commit baa818089f9721eba6b10f4326e0c25d0ce1cf33 (HEAD -> main, origin/main, origin/HEAD)
Author: ticktechman <geek.wystan@gmail.com>
Date: 2024-04-03 19:46:27 +0800
DS_Store
M mac-defaults.sh
## show details of one commit
$ git show baa818089f9721eba6b10f4326e0c25d0ce1cf33
commit baa818089f9721eba6b10f4326e0c25d0ce1cf33 (HEAD -> main, origin/main, origin/HEAD)
Author: ticktechman <geek.wystan@gmail.com>
Date: 2024-04-03 19:46:27 +0800
DS_Store
diff --git a/mac-defaults.sh b/mac-defaults.sh
index 3070b28..19bdb8c 100644
--- a/mac-defaults.sh
+++ b/mac-defaults.sh
@@ -213,6 +213,12 @@ function defaults.finder.set() {
## don't show recent tags in sidebar
defaults write com.apple.finder ShowRecentTags -bool false
+ ## don't write .DS_Store file on network volumns
+ defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
+
+ ## don't write .DS_Store file on local volumns
+ defaults write com.apple.desktopservices DSDontWriteLocalDotFiles true
+
## change list view font & icon size
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:ExtendedListViewSettingsV2:textSize 14" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:ExtendedListViewSettingsV2:iconSize 32" ~/Library/Preferences/com.apple.finder.plist