Select an operation and fill in the parameters to get directly executable Git commands: commit, branch, merge, rebase, reset, remote, push and pull, staging, tag, log and clone, a total of twelve categories.
100% Browser local processing0 Data upload
🌿 Command assembly
Number of parameterscommand lengthPlease fill in the submission messagePlease fill in the target branch to be merged or rebasedPlease fill in the branch namePlease fill in the remote addressPlease fill in the target version to reset toPlease fill in the label namePlease fill in the address of the warehouse to be clonedClone depth should be a number
After filling out the form, click "Generate Command"Command generatedPlease check your inputThe result is empty, execute the generation firstCopied to clipboardDownload has started
💡 Instructions for use
The branch name and remote name must be written correctly. Misspelled commands often do not report an error but take effect on other branches.
Commands involving reset, force push, and rebase will rewrite history. Please confirm the branch and target before execution.
Check Bind Upstream when pushing a new branch for the first time. You can omit the remote and branch names for subsequent pushes and pulls.
The command is output in a single line, making it easy to paste directly into the terminal; it is recommended to save the steps that need to be repeated into a script.
🌿 The three most commonly used operations
Daily use focuses on three categories: recording changes (submit, temporary save, store), parallelizing branches (create, switch, merge, rebase), and synchronizing with remote (push, pull, bind upstream). These three categories cover the vast majority of workflows, and the remaining commands are mostly for troubleshooting problems, such as viewing history, retrieving lost submissions, and comparing the differences between two versions. First identify which category it belongs to, and then select the corresponding command to minimize the scope of changes.
First distinguish whether it belongs to recording, branching or synchronization, and then select the corresponding command.
↕ Push and pull directions
Push is to send local submissions to the remote, and pull is to get remote submissions back to the local. The parameters of both are written in the same way: write the remote name first, then the branch name. It is recommended to bind the upstream when pushing a new branch for the first time. Afterwards, the parameters can be omitted for pushing and pulling of the branch with the same name. Select automatic rebase when pulling, so that local commits that have not yet been forked can be directly stacked on top of the latest commit, making the history easier to read; if you want to strictly not allow forks, select only allow fast forwarding.
When pushing a new branch for the first time, it must be bound to the upstream. After that, the remote and branch names can be omitted.
⚠ Three commands that will lose changes
If you choose to modify the workspace at the same time when resetting to a certain version, uncommitted changes will be discarded directly; force push will overwrite other people's submissions on the remote; rebasing a pushed branch will make the history of collaborators inconsistent. For these three operations, you need to confirm the branch name and target again after generating the command. Especially if the reset target is written incorrectly, it will be difficult to recover the lost changes. A safe alternative is to store the changes in stash and verify that they are correct before executing.
Before resetting, pushing, or rebasing a pushed branch, confirm the branch and target.
🧯 Remedies after errors
If you make a wrong commit, you can modify the latest commit and add in the missing files; if you point to the wrong branch, you can use reset to move the pointer back to the previous commit; if you delete a branch by mistake, you can rebuild it as long as you remember the commit number; if there is a conflict in the middle of a merge or rebase, continue after resolving it, or give up if you don't want to continue, and the command will take you back to the state before the operation. Mastering these remedial commands will help you avoid panic when encountering problems and reduce the risk of accidentally deleting code.
The first step in remediation is usually to find the correct commit number and get the pointer back there.
It is recommended to pull first and then submit to reduce the probability of being rejected when pushing; if there is already a submission locally, pulling it by rebasing can keep the history straight.
How to correct the wrong branch??
You can change the name using Rename, which will not affect the submission history; if you just cut the wrong branch, just switch to it and start again.
Why is the push rejected??
Most of them are remote and have commits that you don't have locally. Pull, merge or rebase first, and then push; force pushing will overwrite other people's submissions, so be careful.
Will uncommitted changes be lost??
Cut branches are generally retained, but will be discarded by resetting to an older version or conflicting abandonment operations. It is safer to submit or store it before taking action.
Which one should I choose between merging and rebasing??
If you want to keep branch and fork records, choose merge; if you want to get a straight line history, choose rebase. Do not rebase the pushed branch.
What is the difference between tags and branches?
The branch will move with new commits, and the label will be fixed on a certain commit; it is more appropriate to use labels with descriptions for release versions.
This site is a mirror site and the function has been disabled
The content of this page comes from Hongmu Notes. The copyright and functions are only authorized to be used on the original site. Please visit the original site for the full experience:
Visit the original website www.4s5.cn
📝 Tool feedback
Does this tool have page clutter issues?
Does this tool function properly?
Verification Code: Please calculate the result
…
The verification code is incorrect or has expired; please re-enter it.
Thanks for your feedback! We will deal with and fix this issue as soon as possible after receiving it.
The verification code failed to load; please click ↻ to retry.Please first enter the CAPTCHA answer.
Appearance settings
color matching
Font size
first prizeThank you for participatingSecond Prizedo it againthird prizemystery giftOptionsAt parties or events, you usually strike up conversations with strangersAfter spending a whole day with many people, you will feel tired and need to be aloneYou like to be the center of conversationYou enjoy deep chatting with a few friends more than lively occasionsWhen you need to think, you are more willing to speak or write it out and discuss it with othersCold calls or last-minute invitations often make you feel stressedDuring breaks you tend to go out and meet friends instead of staying at homeYou believe more in facts you see with your own eyes than in abstract speculationsYou often imagine various possibilities for the futureInstructions or process steps are helpful to youYou are more likely to remember overall impressions than specific detailsYou like to use metaphors and associations to explain somethingYou focus more on what you need to do now rather than the long-term blueprintWhen reading a story, you care more about whether the plot is close to realityWhen making a decision, you will first look at whether the data and logic are validWhen a friend complains, your first reaction is to comfort him rather than give him advice.When a mistake is pointed out, you care more about the objectiveness of the reasons rather than the tone of voice.You will adjust your expression in order to maintain relationship harmonyWhen evaluating a plan, you first pay attention to its feasibility and efficiencyYou are easily affected by other people's emotionsDo you think fairness is more important than favor?Before you go on a trip, you are used to planning your itinerary clearly.A last-minute change of plans can make you feel excited rather than upsetYou are used to making to-do lists and completing them one by oneYour desktop or files are often placed casually but you can find them by yourselfYou feel uncomfortable when things are unresolved and tend to make decisions as quickly as possibleYou like to keep your options open and decide laterYou'll meet deadlines well in advance rather than rushing at the last minuteStrongly disagreeDisagreeNot sureAgreeStrongly agreeIndependent strategist: good at long-term planning, emphasizing logic and efficiency, and likes to put ideas into systems.Logic Explorer: Strong curiosity, likes to dismantle principles, and hates being bound by processes.Goal-driven commander: Good at coordinating resources and pushing the team to achieve results.Witty debater: has many ideas, quick reactions, and likes to challenge established conclusions.Advocates who understand people's hearts: value meaning and value, and be sensitive to the emotions of others.Idealists: Have clear values in their hearts and pursue truth and creation.Contagious leader: good at encouraging others and willing to promote cooperation.Passionate thinker: has broad interests and is good at connecting people and opportunities.Pragmatic Guardian: Reliable, rule-abiding, emphasizing facts and responsibilities.Meticulous protector: considerate, patient, and willing to silently support those around him.Efficient organizer: strong execution ability and habit of arranging things in an orderly manner.Enthusiastic Coordinator: Values interpersonal harmony and is willing to take care of the needs of the group.A calm doer: strong in practical skills, calm in situations, and good at troubleshooting.Gentle artist: Feels delicately and likes to express through actions rather than words.Flexible activist: quick to respond and willing to solve problems in actual combat.A dynamic performer who enjoys the moment and is good at heating up the place.If you suddenly have a whole day free on the weekend, you willInvite friends to go out for a walkCatching up on sleep and watching dramas at homeDepends on your mood, make a temporary decisionWhen joining a new group chat, you usuallySend an emoji first to enliven the atmosphereSilently watching everyone chattingDive first, and then chime in when you encounter a topic of interest.A friend asks you to do a difficult favor. What will you do?Commit first and then think of a solutionFirst assess whether you can do itExplain the difficulties directly and discuss them togetherBoth options have their own pros and cons, which one do you prefer?List the score sheet for item-by-item comparisonChoose the one that is more pleasing to your eyes based on your intuition.Try it on a small scale first before decidingWhen faced with a new task, your first step is toGet started right away and adjust as you goFind information first to get the full pictureTalk to people who have done it and talk about their experiencesWhen your plans are temporarily disrupted, youAdjust quickly and even get a little excitedIt's a bit annoying, but I'll do it againLet’s figure out the new goals first.Before making important decisions, you believe morePast data and experienceown feelingsAdvice from people around youIn the team you play more oftenperson who drives progressA person who sorts out logicThe person who harmonizes the atmosphereWhen learning new skills, you preferStart working on the project directlyRead the system tutorial firstFind an example and follow itWhen others criticize your work, you willFirst ask what exactly is wrongIt's a bit uncomfortable, but I'll remember itSay it's okay with your mouth, think about it laterThe ideal working condition isFast pace and lots of changesStable and predictableFree and able to make arrangements by oneselfyou would rather spend your timemeet different peopleDo one thing to the extremeTry new thingsCharge Captain: Sociable and decisive, able to quickly determine direction in chaos.Robust commander: He is good at leading people and also pays attention to steps. He is the anchor of the team.Passionate initiator: Driven by passion, he can often bring everyone together with just one sentence.Heart-warming executor: Cares about everyone's feelings and is willing to do the details well.Calm planner: Does not talk much, but has clear logic and quick judgment.In-depth researcher: Likes to study alone and pays attention to methods and causes and consequences.Intuitive Creator: Feels strongly inside and acts quickly when inspiration comes.Still water deep flow type: sensitive, patient, good at polishing one thing for a long time.S gregariousL aloneH mindF heartQ fast paceM slow pace(living in groups% 、 头脑% 、 快节奏Custom colorDrag the image here, or click to upload<p>Supports common image formats such as JPG, PNG, WebP, GIF, and BMP<br>You can also directly<kbd>Ctrl</kbd>+<kbd>V</kbd>Paste picture<br> Once processing is complete, you can download the items one by one, or package them into a ZIP file for one-click download.</p>➕ Continue to add⬇ Download all✕ Clear the listNo files yet, please upload pictures<p>共 <strong>{n}</strong>files</p>Processing…Processing completedImage loading failedPlease upload image fileList clearedRemovedDownloadPreviewCloseProcessing result previewDownload has startedNo files available for downloadAre you sure you want to clear all files?It is recommended not to exceed {max} images at a time📦 Package download ZIP: ''' }[c];
});
}
function stripExt(name) {
return String(name).replace(/\.[^.]+$/, '');
}
function resolveEl(ref) {
if (!ref) return null;
return typeof ref === 'string' ? document.getElementById(ref) : ref;
}
function format(str, data) {
if (!data) return str;
Object.keys(data).forEach(function (k) {
str = str.split('{' + k + '}').join(data[k]);
});
return str;
}
function readI18n(sel) {
var out = {};
var box = document.querySelector(sel || '#ie-i18n');
if (!box) return out;
box.querySelectorAll('[data-key]').forEach(function (el) {
out[el.getAttribute('data-key')] = el.textContent.trim();
});
return out;
}
function loadImage(file) {
return new Promise(function (resolve, reject) {
var reader = new FileReader();
reader.onload = function (e) {
var img = new Image();
img.onload = function () { resolve(img); };
img.onerror = function () { reject(new Error('image decode failed')); };
img.src = e.target.result;
};
reader.onerror = function () { reject(new Error('file read failed')); };
reader.readAsDataURL(file);
});
}
function canvasToBlob(canvas, type, quality) {
return new Promise(function (resolve, reject) {
canvas.toBlob(function (blob) {
if (blob) resolve(blob);
else reject(new Error('canvas export failed'));
}, type, quality);
});
}
function makeCanvas(w, h) {
var c = document.createElement('canvas');
c.width = Math.max(1, Math.round(w));
c.height = Math.max(1, Math.round(h));
return c;
}
function ctxOf(canvas) {
return canvas.getContext('2d');
}
function fitSize(w, h, maxW, maxH) {
if (!maxW && !maxH) return { w: w, h: h };
var scale = Math.min(maxW ? maxW / w : Infinity, maxH ? maxH / h : Infinity, Infinity);
if (scale >= 1) return { w: w, h: h }; // 不放大
return { w: Math.max(1, Math.round(w * scale)), h: Math.max(1, Math.round(h * scale)) };
}
function thumbnail(img, maxSide, bg) {
var s = fitSize(img.naturalWidth, img.naturalHeight, maxSide, maxSide);
var c = makeCanvas(s.w, s.h);
var ctx = ctxOf(c);
if (bg) { ctx.fillStyle = bg; ctx.fillRect(0, 0, s.w, s.h); }
ctx.drawImage(img, 0, 0, s.w, s.h);
return c.toDataURL('image/jpeg', 0.9);
}
function buildUI(root, opts, labels) {
var uid = 'ie' + Math.random().toString(36).slice(2, 7);
var ids = {
drop: uid + '-drop',
input: uid + '-input',
panel: uid + '-panel',
preview: uid + '-preview',
toolbar: uid + '-toolbar',
addMore: uid + '-add-more',
downAll: uid + '-download-all',
clear: uid + '-clear',
count: uid + '-count',
list: uid + '-list',
empty: uid + '-empty'
};
var html =
'
[ImgEdit] readOptions error[ImgEdit] processing failed:[ImgEdit] Loading failed:[ImgEdit] editor.setup errorPacking, please waitPacking {done}/{total}Packaging completed, download has startedPackaging failed, please try againCopiedCopy failedIllegal characters:Expression is incompleteUnknown symbol:extra right bracketillegal expressionExpression has redundant contentThis site is a mirror site and the function has been disabledThe content of this page comes from Hongmu Notes. The copyright and functions are only authorized to be used on the original site.Visit original siteLocate that line and delete itSubmission failed, please try again later(Current data totalcolumn):''' }[c];
});
}
// ============ 主题切换(与博客首页同一套:data-theme + tui-theme)============
function isDark() {
var el = document.documentElement;
return el.getAttribute('data-theme') === 'dark' || el.classList.contains('dark-mode');
}
function setTheme(dark) {
var el = document.documentElement;
el.setAttribute('data-theme', dark ? 'dark' : 'light');
el.classList.toggle('dark-mode', dark); // 兼容部分工具内部旧的 .dark-mode 规则
try {
localStorage.setItem('tui-theme', dark ? 'dark' : 'light');
localStorage.setItem('a6_dark_mode', dark ? '1' : '0');
} catch (e) {}
}
function initTheme() {
var btn = document.getElementById('tuiThemeBtn') || document.getElementById('t-theme');
if (!btn) return;
function sync() { btn.classList.toggle('is-dark', isDark()); }
sync();
btn.addEventListener('click', function () {
setTheme(!isDark());
sync();
});
}
// ============ 返回顶部 ============
function initTop() {
var btn = document.getElementById('tuiTopBtn');
if (!btn) return;
function onScroll() {
btn.style.display = (window.pageYOffset > 300) ? '' : 'none';
}
window.addEventListener('scroll', onScroll, { passive: true });
onScroll();
btn.addEventListener('click', function () {
window.scrollTo({ top: 0, behavior: 'smooth' });
});
}
// ============ 工具目录:精确悬浮在内容卡片右侧 ============
// 用 JS 读取主体卡片的真实右边界来定位(不依赖 CSS 计算),
// 右侧空间不足时自动回退为顶部横滑胶囊(移除 inline 定位即可)。
function initTocFloat() {
var aside = document.querySelector('.t-toc-aside');
var main = document.querySelector('.t-layout .t-main');
if (!aside || !main) return;
var GAP = 14; // 目录与卡片间距
var W = 224; // 目录宽度(与 CSS 的 .t-toc-aside 宽度保持一致)
function reset() {
aside.style.position = '';
aside.style.left = '';
aside.style.right = '';
aside.style.top = '';
aside.style.width = '';
aside.style.maxHeight = '';
aside.style.overflowY = '';
aside.classList.remove('is-floating');
}
function layout() {
reset();
if (window.innerWidth < 1024) return; // 窄屏:胶囊布局
var box = main.getBoundingClientRect();
var left = Math.round(box.left - GAP - W); // 目录放在卡片左侧(与内容页目录一致)
if (left < 8) return; // 左侧放不下:胶囊布局
aside.style.position = 'fixed';
aside.style.left = left + 'px';
aside.style.top = '84px';
aside.style.width = W + 'px';
aside.style.maxHeight = 'calc(100vh - 110px)';
aside.style.overflowY = 'auto';
aside.style.zIndex = '5';
aside.classList.add('is-floating');
}
layout();
window.addEventListener('resize', layout, { passive: true });
window.addEventListener('load', layout);
window.setTimeout(layout, 300); // 字体/图片加载后校正一次
}
// ============ 外观设置(配色 + 字号,记忆在 localStorage) ============
function initAppearance() {
var btn = document.getElementById('tAppearanceBtn');
var panel = document.getElementById('tAppearance');
if (!btn || !panel) return;
function read(k) { try { return localStorage.getItem(k) || ''; } catch (e) { return ''; } }
function write(k, v) { try { localStorage.setItem(k, v); } catch (e) {} }
function apply(accent, fs) {
var el = document.documentElement;
if (accent && accent !== 'default') { el.setAttribute('data-accent', accent); }
else { el.removeAttribute('data-accent'); }
if (fs && fs !== 'm') { el.setAttribute('data-fs', fs); }
else { el.removeAttribute('data-fs'); }
var i, list = panel.querySelectorAll('[data-accent]');
for (i = 0; i < list.length; i++) {
list[i].classList.toggle('is-on', list[i].getAttribute('data-accent') === (accent || 'default'));
}
list = panel.querySelectorAll('[data-fs]');
for (i = 0; i < list.length; i++) {
list[i].classList.toggle('is-on', list[i].getAttribute('data-fs') === (fs || 'm'));
}
}
var cur = { accent: read('t-accent') || 'default', fs: read('t-fs') || 'm' };
apply(cur.accent, cur.fs);
btn.addEventListener('click', function (e) {
e.stopPropagation();
panel.hidden = !panel.hidden;
});
var close = document.getElementById('tAppearanceClose');
if (close) close.addEventListener('click', function () { panel.hidden = true; });
panel.addEventListener('click', function (e) {
var t = e.target;
if (!t || !t.getAttribute) return;
var ac = t.getAttribute('data-accent');
var fs = t.getAttribute('data-fs');
if (ac) { cur.accent = ac; write('t-accent', ac); apply(cur.accent, cur.fs); }
if (fs) { cur.fs = fs; write('t-fs', fs); apply(cur.accent, cur.fs); }
});
document.addEventListener('click', function (e) {
if (panel.hidden) return;
if (panel.contains(e.target) || e.target === btn) return;
panel.hidden = true;
});
}
// 页面底部脚本加载,DOM 已就绪,直接初始化
initTheme();
initTop();
initTocFloat();
initAppearance();
// ============ 对外暴露 ============
window.Tools = {
isLocal: isLocalFile || isWrongHost,
audio: getAudio,
toast: toast,
copy: copy,
note: note,
chord: chord,
midiName: midiName,
midiFreq: midiFreq,
NOTE_NAMES: NOTE_NAMES,
esc: esc,
theme: initTheme,
};
// ============ 本地/非法域名提示 ============
if (window.Tools.isLocal) {
document.addEventListener('DOMContentLoaded', function () {
var tip = document.createElement('div');
tip.style.cssText = 'position:fixed;left:50%;top:20px;transform:translateX(-50%);'
+ 'background:#e74c3c;color:#fff;padding:10px 20px;border-radius:8px;'
+ 'font-size:.9rem;z-index:99999;';
tip.textContent = '请从 4s5.cn 访问本工具';
document.body.appendChild(tip);
setTimeout(function () { tip.style.opacity = '0'; tip.style.transition = 'opacity .5s'; }, 3000);
setTimeout(function () { tip.parentNode && tip.parentNode.removeChild(tip); }, 3600);
});
}
})();
(function (window, document) {
'use strict';
var SEL = 'ins.adsbygoogle, ins.adsbygoogle iframe, iframe[id^=