<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>ShawnDeng's Tech Blog</title><link>https://shawndeng.tech/</link><description>Recent content on ShawnDeng's Tech Blog</description><generator>Hugo -- 0.146.0</generator><language>zh-cn</language><lastBuildDate>Fri, 06 Mar 2026 04:20:00 +0800</lastBuildDate><atom:link href="https://shawndeng.tech/index.xml" rel="self" type="application/rss+xml"/><item><title>Git Worktree 实战指南：平行开发的秘密武器</title><link>https://shawndeng.tech/posts/git-worktree-practical-guide/</link><pubDate>Fri, 06 Mar 2026 04:20:00 +0800</pubDate><guid>https://shawndeng.tech/posts/git-worktree-practical-guide/</guid><description>&lt;h2 id="前言">前言&lt;/h2>
&lt;p>你是否经历过这样的场景？&lt;/p>
&lt;p>当你正在为某个功能跑漫长的测试时，突然来了一个紧急的 bug 要修复，但你又不能随便动工作区的代码，因为测试还在进行。此时只能无奈地切换分支，导致 &lt;code>node_modules&lt;/code> 需要重新安装，编译需要重新进行&amp;hellip;&lt;/p>
&lt;p>&lt;strong>Git Worktree&lt;/strong> 就是来解决这个问题的。它允许你在同一个 Git 仓库中同时维护多个工作目录，每个目录可以检出不同的分支，彼此独立。&lt;/p>
&lt;p>这篇文章将从理论到实战，深入讲解如何使用 Git Worktree 来优化你的开发流程。&lt;/p>
&lt;hr>
&lt;h2 id="什么是-git-worktree">什么是 Git Worktree？&lt;/h2>
&lt;h3 id="基本概念">基本概念&lt;/h3>
&lt;p>Git Worktree（工作树）是一个 Git 特性，允许你在&lt;strong>同一个 Git 仓库中创建多个工作目录&lt;/strong>。&lt;/p>
&lt;p>在没有 Worktree 之前：&lt;/p>
&lt;ul>
&lt;li>一个仓库 = 一个工作目录&lt;/li>
&lt;li>切换分支会改变当前工作目录的文件状态&lt;/li>
&lt;li>如果当前工作目录有未提交的改动，切换分支可能很困难&lt;/li>
&lt;/ul>
&lt;p>有了 Worktree 之后：&lt;/p>
&lt;ul>
&lt;li>一个仓库 = 多个独立的工作目录&lt;/li>
&lt;li>每个工作目录可以检出不同的分支&lt;/li>
&lt;li>多个目录可以同时进行开发，互不影响&lt;/li>
&lt;/ul>
&lt;h3 id="工作树-vs-传统分支">工作树 vs 传统分支&lt;/h3>
&lt;p>&lt;strong>常见误解：&lt;/strong> 工作树是对分支的替代&lt;/p>
&lt;p>&lt;strong>正确理解：&lt;/strong> 工作树是对分支的一种**&amp;ldquo;文件系统视图&amp;rdquo;**&lt;/p>
&lt;ul>
&lt;li>&lt;strong>分支&lt;/strong>：Git 中用来隔离开发路线的概念，存储在 &lt;code>.git/refs/heads/&lt;/code> 中&lt;/li>
&lt;li>&lt;strong>工作树&lt;/strong>：只是物理上创建了一个新的目录，让你能同时看到/编辑多个分支&lt;/li>
&lt;/ul>
&lt;p>分支的数量和数目都不会因为创建工作树而改变，工作树只是给了你一个新的&amp;quot;窗口&amp;quot;去访问这些分支。&lt;/p>
&lt;hr>
&lt;h2 id="为什么需要-git-worktree">为什么需要 Git Worktree？&lt;/h2>
&lt;h3 id="常见应用场景">常见应用场景&lt;/h3>
&lt;h4 id="1-场景修复紧急-bug不中断当前工作">1️⃣ &lt;strong>场景：修复紧急 bug，不中断当前工作&lt;/strong>&lt;/h4>
&lt;p>你正在 &lt;code>feature/new-api&lt;/code> 分支上开发新功能，代码还未提交。突然生产环境爆出一个 bug，需要立即修复。&lt;/p>
&lt;p>&lt;strong>传统做法：&lt;/strong>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># 代码还没 commit，必须先 stash&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git stash
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># 切回 main 分支&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git checkout main
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># 修复 bug，提交&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git commit -m &lt;span style="color:#e6db74">&amp;#34;fix: xxx&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># 切回开发分支&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git checkout feature/new-api
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># 恢复代码&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git stash pop
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>问题：如果项目很大（如前端项目有巨大的 node_modules），即使只是切换分支也要重新安装依赖！&lt;/p></description></item><item><title>Hello World - 我的博客上线了！</title><link>https://shawndeng.tech/posts/hello-world/</link><pubDate>Tue, 24 Feb 2026 10:00:00 +0800</pubDate><guid>https://shawndeng.tech/posts/hello-world/</guid><description>&lt;h2 id="欢迎">欢迎！👋&lt;/h2>
&lt;p>这是我的第一篇博客文章。在这里，我会分享：&lt;/p>
&lt;ul>
&lt;li>💻 &lt;strong>技术文章&lt;/strong> - 编程经验和心得&lt;/li>
&lt;li>🛠️ &lt;strong>项目记录&lt;/strong> - 有趣的项目开发过程&lt;/li>
&lt;li>📚 &lt;strong>学习笔记&lt;/strong> - 新技术的探索和总结&lt;/li>
&lt;li>💡 &lt;strong>思考感悟&lt;/strong> - 对技术和生活的思考&lt;/li>
&lt;/ul>
&lt;h2 id="博客技术栈">博客技术栈&lt;/h2>
&lt;p>这个博客使用的技术：&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Hugo&lt;/strong> - 超快的静态网站生成器&lt;/li>
&lt;li>&lt;strong>PaperMod&lt;/strong> - 简洁优雅的主题&lt;/li>
&lt;li>&lt;strong>Nginx&lt;/strong> - Web 服务器&lt;/li>
&lt;li>&lt;strong>Let&amp;rsquo;s Encrypt&lt;/strong> - 免费的 SSL 证书&lt;/li>
&lt;/ul>
&lt;h2 id="代码示例">代码示例&lt;/h2>
&lt;p>来个经典的 Hello World：&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-python" data-lang="python">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">def&lt;/span> &lt;span style="color:#a6e22e">hello_world&lt;/span>():
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> print(&lt;span style="color:#e6db74">&amp;#34;Hello, World!&amp;#34;&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> print(&lt;span style="color:#e6db74">&amp;#34;欢迎来到我的博客！&amp;#34;&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">if&lt;/span> __name__ &lt;span style="color:#f92672">==&lt;/span> &lt;span style="color:#e6db74">&amp;#34;__main__&amp;#34;&lt;/span>:
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> hello_world()
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-javascript" data-lang="javascript">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">function&lt;/span> &lt;span style="color:#a6e22e">helloWorld&lt;/span>() {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">console&lt;/span>.&lt;span style="color:#a6e22e">log&lt;/span>(&lt;span style="color:#e6db74">&amp;#34;Hello, World!&amp;#34;&lt;/span>);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#a6e22e">console&lt;/span>.&lt;span style="color:#a6e22e">log&lt;/span>(&lt;span style="color:#e6db74">&amp;#34;欢迎来到我的博客！&amp;#34;&lt;/span>);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a6e22e">helloWorld&lt;/span>();
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="结语">结语&lt;/h2>
&lt;p>希望这个博客能成为我记录技术成长的地方，也希望能帮到访问的你。&lt;/p>
&lt;p>Stay tuned! 🚀&lt;/p></description></item><item><title>GitHub 开源项目</title><link>https://shawndeng.tech/github/</link><pubDate>Tue, 24 Feb 2026 00:00:00 +0000</pubDate><guid>https://shawndeng.tech/github/</guid><description>&lt;div id="github-app">&lt;/div>
&lt;style>
.github-container {
max-width: 1200px;
margin: 0 auto;
padding: 20px;
}
.controls {
margin-bottom: 30px;
display: flex;
gap: 15px;
flex-wrap: wrap;
align-items: center;
}
.search-box {
flex: 1;
min-width: 250px;
padding: 12px 20px;
border: 2px solid #e1e4e8;
border-radius: 8px;
font-size: 16px;
transition: all 0.3s;
}
.search-box:focus {
outline: none;
border-color: #0366d6;
box-shadow: 0 0 0 3px rgba(3, 102, 214, 0.1);
}
.filter-buttons {
display: flex;
gap: 10px;
flex-wrap: wrap;
}
.filter-btn {
padding: 8px 16px;
border: 2px solid #e1e4e8;
background: white;
border-radius: 20px;
cursor: pointer;
transition: all 0.3s;
font-size: 14px;
font-weight: 500;
}
.filter-btn:hover {
border-color: #0366d6;
background: #f6f8fa;
}
.filter-btn.active {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border-color: transparent;
}
.stats-bar {
display: flex;
gap: 20px;
margin-bottom: 30px;
padding: 20px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border-radius: 12px;
color: white;
flex-wrap: wrap;
}
.stat-item {
display: flex;
align-items: center;
gap: 8px;
}
.stat-icon {
font-size: 24px;
}
.stat-value {
font-size: 28px;
font-weight: bold;
}
.stat-label {
font-size: 14px;
opacity: 0.9;
}
.repos-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
gap: 25px;
margin-bottom: 30px;
}
.repo-card {
background: white;
border: 1px solid #e1e4e8;
border-radius: 12px;
padding: 24px;
transition: all 0.3s;
position: relative;
overflow: hidden;
}
.repo-card::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
height: 4px;
background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
transform: scaleX(0);
transition: transform 0.3s;
}
.repo-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}
.repo-card:hover::before {
transform: scaleX(1);
}
.repo-header {
display: flex;
justify-content: space-between;
align-items: flex-start;
margin-bottom: 12px;
}
.repo-name {
font-size: 20px;
font-weight: 600;
color: #0366d6;
text-decoration: none;
display: flex;
align-items: center;
gap: 8px;
word-break: break-word;
flex: 1;
}
.repo-name:hover {
text-decoration: underline;
}
.repo-visibility {
padding: 4px 10px;
border-radius: 12px;
font-size: 12px;
font-weight: 500;
background: #f6f8fa;
border: 1px solid #e1e4e8;
white-space: nowrap;
}
.repo-description {
color: #586069;
margin-bottom: 16px;
line-height: 1.5;
min-height: 40px;
}
.repo-stats {
display: flex;
gap: 16px;
margin-bottom: 12px;
font-size: 14px;
color: #586069;
}
.stat {
display: flex;
align-items: center;
gap: 4px;
}
.repo-language {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 6px 12px;
background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
border-radius: 16px;
font-size: 13px;
font-weight: 500;
}
.language-dot {
width: 10px;
height: 10px;
border-radius: 50%;
}
.loading {
text-align: center;
padding: 60px 20px;
font-size: 18px;
color: #586069;
}
.loading-spinner {
border: 4px solid #f3f3f3;
border-top: 4px solid #667eea;
border-radius: 50%;
width: 50px;
height: 50px;
animation: spin 1s linear infinite;
margin: 20px auto;
}
.error-message {
text-align: center;
padding: 60px 20px;
color: #d73a49;
font-size: 16px;
background: #ffeef0;
border-radius: 8px;
margin: 20px 0;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.no-results {
text-align: center;
padding: 60px 20px;
color: #586069;
font-size: 18px;
}
@media (max-width: 768px) {
.repos-grid {
grid-template-columns: 1fr;
}
.stats-bar {
flex-direction: column;
}
}
&lt;/style>
&lt;script>
(function() {
'use strict';
const username = 'shawndenggh';
let allRepos = [];
let filteredRepos = [];
let currentLanguage = 'all';
const languageColors = {
JavaScript: '#f1e05a',
Python: '#3572A5',
Java: '#b07219',
Go: '#00ADD8',
TypeScript: '#2b7489',
C: '#555555',
'C++': '#f34b7d',
'C#': '#178600',
PHP: '#4F5D95',
Ruby: '#701516',
Swift: '#ffac45',
Kotlin: '#F18E33',
Rust: '#dea584',
HTML: '#e34c26',
CSS: '#563d7c',
Vue: '#41b883',
Dart: '#00B4AB',
Shell: '#89e051',
default: '#8257e6'
};
function getLanguageColor(language) {
return languageColors[language] || languageColors.default;
}
function createApp() {
const app = document.getElementById('github-app');
app.innerHTML = `
&lt;div class="github-container">
&lt;div class="loading" id="loading">
&lt;div class="loading-spinner">&lt;/div>
&lt;p>正在加载 GitHub 仓库...&lt;/p></description></item><item><title>关于我</title><link>https://shawndeng.tech/about/</link><pubDate>Tue, 24 Feb 2026 00:00:00 +0000</pubDate><guid>https://shawndeng.tech/about/</guid><description>&lt;h2 id="-hi我是-shawn-deng">👋 Hi，我是 Shawn Deng&lt;/h2>
&lt;p>一个热爱技术的&lt;strong>全栈工程师&lt;/strong>，同时也是 &lt;strong>Vibe Coding Agent 工程师&lt;/strong>，专注于用代码创造价值。&lt;/p>
&lt;hr>
&lt;h2 id="-职业经历">💼 职业经历&lt;/h2>
&lt;p>&lt;strong>当前职位：&lt;/strong> Vika 维格云 - 后端技术负责人（至今）&lt;/p>
&lt;ul>
&lt;li>负责后端架构设计与技术选型&lt;/li>
&lt;li>带领团队进行产品研发与技术攻关&lt;/li>
&lt;li>推动技术创新与最佳实践落地&lt;/li>
&lt;/ul>
&lt;!-- 🔧 TODO: 如果有之前的工作经历，可以继续补充 -->
&lt;p>&lt;strong>之前经历：&lt;/strong>&lt;/p>
&lt;ul>
&lt;li>【可以补充之前的公司经历】&lt;/li>
&lt;/ul>
&lt;hr>
&lt;h2 id="-技术栈">🛠️ 技术栈&lt;/h2>
&lt;h3 id="编程语言">编程语言&lt;/h3>
&lt;ul>
&lt;li>&lt;strong>主力语言：&lt;/strong> Java / Node.js / JavaScript / TypeScript&lt;/li>
&lt;li>&lt;strong>前端框架：&lt;/strong> React.js / Vue.js&lt;/li>
&lt;li>&lt;strong>也在用：&lt;/strong> Python / Go / Shell 等其他语言&lt;/li>
&lt;/ul>
&lt;h3 id="框架--工具">框架 &amp;amp; 工具&lt;/h3>
&lt;ul>
&lt;li>&lt;strong>后端：&lt;/strong> Spring Boot / Express / Nest.js&lt;/li>
&lt;li>&lt;strong>前端：&lt;/strong> React / Vue / Next.js&lt;/li>
&lt;li>&lt;strong>数据库：&lt;/strong> MySQL / PostgreSQL / MongoDB / Redis&lt;/li>
&lt;li>&lt;strong>DevOps：&lt;/strong> Docker / Kubernetes / CI/CD&lt;/li>
&lt;li>&lt;strong>其他：&lt;/strong> Git / Nginx / Linux&lt;/li>
&lt;/ul>
&lt;hr>
&lt;h2 id="-当前关注">🎯 当前关注&lt;/h2>
&lt;p>最近在研究：&lt;/p></description></item><item><title>友情链接</title><link>https://shawndeng.tech/links/</link><pubDate>Tue, 24 Feb 2026 00:00:00 +0000</pubDate><guid>https://shawndeng.tech/links/</guid><description>&lt;h2 id="欢迎交换友链">欢迎交换友链！&lt;/h2>
&lt;p>如果你也有技术博客，欢迎交换友链。可以通过以下方式联系我：&lt;/p>
&lt;ul>
&lt;li>📧 Email: &lt;a href="mailto:shawndgh@163.com">shawndgh@163.com&lt;/a>&lt;/li>
&lt;li>🐙 GitHub: &lt;a href="https://github.com/shawndenggh">@shawndenggh&lt;/a>&lt;/li>
&lt;/ul>
&lt;hr>
&lt;h2 id="友情链接">友情链接&lt;/h2>
&lt;style>
.friend-links {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 20px;
margin: 30px 0;
}
.friend-card {
background: var(--entry);
border: 1px solid var(--border);
border-radius: 12px;
padding: 20px;
transition: all 0.3s;
display: flex;
gap: 15px;
align-items: flex-start;
}
.friend-card:hover {
transform: translateY(-5px);
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
border-color: var(--theme);
}
.friend-avatar {
width: 60px;
height: 60px;
border-radius: 50%;
flex-shrink: 0;
}
.friend-info {
flex: 1;
}
.friend-name {
font-size: 18px;
font-weight: 600;
color: var(--primary);
text-decoration: none;
margin-bottom: 5px;
display: block;
}
.friend-name:hover {
color: var(--theme);
}
.friend-desc {
font-size: 14px;
color: var(--secondary);
line-height: 1.5;
}
@media (max-width: 768px) {
.friend-links {
grid-template-columns: 1fr;
}
}
&lt;/style>
&lt;div class="friend-links">
&lt;div class="friend-card">
&lt;img src="https://avatars.githubusercontent.com/u/39178385?v=4" alt="ShawnDeng" class="friend-avatar" />
&lt;div class="friend-info">
&lt;a href="https://github.com/shawndenggh" class="friend-name" target="_blank">示例友链&lt;/a>
&lt;div class="friend-desc">这是一个示例友链，你可以编辑这个文件添加真实的友链。&lt;/div>
&lt;/div>
&lt;/div>
&lt;!-- 添加更多友链，复制上面的 friend-card 结构 -->
&lt;!--
&lt;div class="friend-card">
&lt;img src="头像链接" alt="名称" class="friend-avatar" />
&lt;div class="friend-info">
&lt;a href="博客链接" class="friend-name" target="_blank">博客名称&lt;/a>
&lt;div class="friend-desc">博客简介&lt;/div>
&lt;/div>
&lt;/div>
-->
&lt;/div>
&lt;hr>
&lt;h2 id="申请友链">申请友链&lt;/h2>
&lt;p>如果想要交换友链，请确保你的博客：&lt;/p></description></item></channel></rss>