日常工作工程化
不知道大家平时工作有没有遇到这样的情况,短时间内多个人一起找你,一时间不知道怎么高效地处理繁杂的信息。
可能你会使用待办、会使用备忘录来临时记录,但是随着时间久了,记录的内容就会到处都是,且后面溯源会非常麻烦,经常找不到源头。
所以,我在经历过如上的场景后,我就在思考如何解决这个问题?
起初我使用了很多软件,例如飞书、有道云笔记、notion等,待办事项使用的是Google日历(这个我在深圳一直用,使用时长至少有2年),一开始我觉得这些软件挺好,多端同步也很方便,但是渐渐地我发现,在多个软件之间跳转经常会把自己跳晕,经常一个页面来回看来确认一个小的点,即使后面配备了双屏也没有得到很好地解决。
后面,数据处理的场景渐渐地变多了,例如经常会批量修正一些数据,会经常会核对一些数据,上面提到的软件就力不从心了。随着自己负责的项目越来越多,经常一个项目有多个事项需要同时进行,例如有确认需求细节的,有关联文档需要关注的、有Bug需要解决的、需要建任务待办的,等等,同一个项目的数据就会分散在多个软件,虽然后面飞书、有道云笔记等也支持了待办,但是还解决不了我一个问题,就是溯源。在线文档虽然有历史记录,但是速度太慢了,而且离开了网络就无法溯源了。
基于以上种种,我决定自己探索适合自己的解决方案。
因为我一直使用Sublime Text来处理文本,恰好Sublime Text也支持打开文件夹,文件夹就是树状结构,那么我就可以使用这个特性来管理工作中的所有事项。每一个事项都建立一个节点来处理。
├──works
├── 1.Daily Reports
├── 2.Business
├── 3.Troubleshooting
├── 4.Performance Communication
├── 5.Miscellaneous
├── 6.Maintenance
├── 7.Sharing
├── 8.Personal
├── README.md
└── p
有了以上的工作结构,我可以把繁琐的事务分散到相应的结构中,这样我就可以处理得有条不紊。为了溯源和支持图文,我结合了git和markdown。 git有良好的history可以看且是离线的,即使是网络有问题也不影响看历史记录。同时,git的版本比较特别方便,只需要点击具体的commit就可以直接定位到改动位置,而不用像在线文档一样加载整个页面。
工程的多端同步,当然是使用Git来做了,Git一开始便是为了协作而生的。所以使用git命令将本地记录提交大到远程仓库,当其他终端需要同步,只需要执行git pull
拉取最新的数据即可。那么既然是工具化了,git相关的命令怎么可以一直重复操作了,当然是写成脚本来处理。树状结构中的p
文件就是git操作的脚本
为什么使用
p
来作为脚本的文件名,是因为我认为其简洁,只需要输入sh p
就可以完成工作。p
代表push
,“推”的意思,表示将变动推送到远程,当然也可以重命名为自己喜欢的名字。
p
的脚本内容如下,大部分是chatGPT帮我完成的:
#!/bin/bash
# 拉取最新代码到本地仓库
echo "=========>>>拉取最新代码到本地仓库,开始fetch操作"
git fetch
echo "=========>>>fetch 成功"
# 检查本地分支是否落后于远程分支,如果是,则先合并远程分支
if [ -n "$(git status -uno | grep 'Your branch is behind')" ]; then
echo "=========>>>本地分支落后于远程分支,先合并远程分支"
git pull
echo "=========>>>合并远程分支完成"
fi
# 获取当前分支
branch=$(git rev-parse --abbrev-ref HEAD)
# 检查是否存在未推送的本地 commit,如果有则先执行推送操作
if [ -n "$(git log origin/${branch}..HEAD --oneline)" ]; then
echo "=========>>>存在未推送的本地 commit,先执行推送操作"
git push
echo "=========>>>push 完成"
fi
# 检查是否存在未提交的修改
if [ -z "$(git status --porcelain)" ]; then
echo "=========>>>当前仓库没有未提交的修改,很干净"
exit 1
fi
timeValue=30
# 获取提交注释
if [ -z "$1" ]
then
echo "=========>>>请在 $timeValue s内输入提交注释,否则使用默认提交信息进行提交 | 快捷操作:直接回车:"
read -t $timeValue message
# echo "=========>>>请输入提交注释,否则使用默认提交信息进行提交 | 快捷操作:直接回车:"
# read message
if [ -z "$message" ]
then
message="add: default commit message"
fi
else
message="$1"
fi
# 添加所有修改到 Git
git add .
# 提交修改
git commit -m "$message" --no-verify
# 输出提交信息
echo "=========>>>提交注释: $message"
# 推送代码到远程 Git 仓库
git push
# 输出推送信息
echo "=========>>>已将代码推送到远程仓库"
工具链
Sublime Text
+ Git
+ Markdown
+ shell
Sublime Text支持插件,例如Markdown里面的图片我就可以直接复制粘贴进来,使用的是imagepaste这个插件.
也正是Sublime Text支持插件,所以我们几乎可以将Sublime Text进行”脱胎换骨”式的个性化定义,从事打造出符合自己需求的高效工具
Engineering Daily Work
I don’t know if you have encountered such a situation in your daily work, where multiple people come to you within a short period of time, and you are unsure how to handle the overwhelming information efficiently.
You may use to-do lists and memo apps to temporarily record tasks, but over time, the content becomes scattered everywhere, and it becomes difficult to trace back and often hard to find the source.
So, after experiencing such scenarios, I started thinking about how to solve this problem.
Initially, I used various software such as Feishu, Youdao Cloud Note, Notion, etc. I used Google Calendar for managing tasks (I have been using it for at least 2 years in Shenzhen). At first, I thought these software solutions were good, and the multi-platform synchronization was convenient. However, I gradually realized that constantly switching between multiple software applications made me feel overwhelmed. Often, I had to go back and forth between different pages just to confirm a small detail, even with dual monitors, it didn’t solve the problem effectively.
Later on, I encountered more scenarios that required data processing, such as batch data corrections or data verification. The aforementioned software solutions couldn’t meet my needs. As I took on more projects, there were multiple tasks associated with each project. For example, there were tasks to confirm detailed requirements, documents to be reviewed, bugs to be fixed, and tasks to be created. The data related to the same project was scattered across multiple software applications. Although tools like Feishu and Youdao Cloud Note also supported to-do lists, they still couldn’t solve one crucial issue for me, which was traceability. While online documents may have a revision history, the speed was slow, and once I was offline, I couldn’t trace the changes.
Based on the above reasons, I decided to explore a solution that would suit my needs.
Since I have been using Sublime Text for text processing, and Sublime Text supports opening folders, where the folder structure resembles a tree, I realized I could utilize this feature to manage all the tasks in my work. Each task is represented by a node in the tree structure.
├──works
├── 1.Daily Reports
├── 2.Business
├── 3.Troubleshooting
├── 4.Performance Communication
├── 5.Miscellaneous
├── 6.Maintenance
├── 7.Sharing
├── 8.Personal
├── README.md
└── p
With this work structure, I can distribute the complex tasks into their respective sections, enabling me to handle them systematically. To support traceability and incorporate rich text features, I combined Git and Markdown.
Git provides a robust history view and works offline, even without network connectivity, which was ideal for my needs. Additionally, Git’s versioning capabilities allowed me to directly locate specific changes with just a click, without the need to load the entire page like online documents.
For multi-platform synchronization, Git naturally became my choice since it was originally designed for collaboration. Therefore, I use Git commands to commit my local records to a remote repository. When other terminals need to sync, they only need to execute git pull
to fetch the latest data. Since this became a tool in itself, I decided to write scripts to handle Git operations. The script file in the tree structure is named p
.
Why use
p
as the file name for the script? I find it concise, and simply typingsh p
can complete the necessary work.p
stands for “push,” indicating the action of pushing changes to the remote repository. Of course, you can rename it to a name you prefer.
The content of the p
script
, which was mostly completed with the help of ChatGPT, is as follows:
#!/bin/bash
# Fetch the latest code changes to the local repository
echo "=========>>>Fetching the latest code changes to the local repository, starting fetch operation"
git fetch
echo "=========>>>Fetch operation completed successfully"
# Check if the local branch is behind the remote branch, if so, merge the remote branch first
if [ -n "$(git status -uno | grep 'Your branch is behind')" ]; then
echo "=========>>>The local branch is behind the remote branch, merging the remote branch"
git pull
echo "=========>>>Merging the remote branch completed"
fi
# Get the current branch
branch=$(git rev-parse --abbrev-ref HEAD)
# Check if there are any local commits not yet pushed, if so, perform the push operation first
if [ -n "$(git log origin/${branch}..HEAD --oneline)" ]; then
echo "=========>>>There are local commits not yet pushed, performing the push operation"
git push
echo "=========>>>Push operation completed"
fi
# Check if there are any uncommitted changes
if [ -z "$(git status --porcelain)" ]; then
echo "=========>>>The current repository has no uncommitted changes, it's clean"
exit 1
fi
timeValue=30
# Get the commit message
if [ -z "$1" ]
then
echo "=========>>>Please enter the commit message within $timeValue seconds, otherwise, use the default commit message | Quick action: press Enter directly:"
read -t $timeValue message
# echo "=========>>>Please enter the commit message, otherwise, use the default commit message | Quick action: press Enter directly:"
# read message
if [ -z "$message" ]
then
message="add: default commit message"
fi
else
message="$1"
fi
# Add all changes to Git
git add .
# Commit the changes
git commit -m "$message" --no-verify
# Output the commit message
echo "=========>>>Commit message: $message"
# Push the code to the remote Git repository
git push
# Output the push message
echo "=========>>>Code has been pushed to the remote repository"
Toolchain
Sublime Text
+ Git
+ Markdown
+ shell
Sublime Text supports plugins, for example, I can directly copy and paste images into Markdown using the
imagepaste
plugin.Sublime Text’s plugin support allows us to customize it according to our needs, effectively creating an efficient tool tailored to our requirements.