← 返回命令列表

Linux command

git-fresh-branch 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Create orphan branch

git fresh-branch [branch_name]

说明

git fresh-branch creates a new orphan branch with no parent commits or history connection to the existing repository. This provides a completely clean slate within the same repository, useful for maintaining entirely separate content streams. The primary use case is gh-pages branches for GitHub Pages hosting, where documentation or website content lives in the same repository but shares no history with the codebase. Other uses include documentation branches, experimental branches, or vendor branches for third-party code. As part of git-extras, this command wraps the more complex git checkout --orphan with additional cleanup steps to ensure a truly fresh starting point.

FAQ

What is the git-fresh-branch command used for?

git fresh-branch creates a new orphan branch with no parent commits or history connection to the existing repository. This provides a completely clean slate within the same repository, useful for maintaining entirely separate content streams. The primary use case is gh-pages branches for GitHub Pages hosting, where documentation or website content lives in the same repository but shares no history with the codebase. Other uses include documentation branches, experimental branches, or vendor branches for third-party code. As part of git-extras, this command wraps the more complex git checkout --orphan with additional cleanup steps to ensure a truly fresh starting point.

How do I run a basic git-fresh-branch example?

Run `git fresh-branch [branch_name]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.