git restore test.txt git restore test.txt(Every non-official build is made from a separate branch.)
It's apparently a business requirement to keep every branch around forever, and I'll just take your word for that. At that point, you can have an `origin` remote where work happens, and the CI can include a push to an `archive` remote which is append-only.
Lets you have a development environment where the existence of a branch on origin means that it's in-play, and everything exists on archive if it proves needful.
Git checkout and a few other commands also use it to separate branch and the rest of paths, because you could specify like this
git checkout branch path1 path2
git checkout path1 path2
git checkout branch # what if there's a file named "branch"?
-- help disambiguates that by being between the branch and the paths, so git checkout branch -- # always checkout a branch
git checkout -- path1 path2 # always checkout paths
git checkout branch -- path1 path2 # same, but disable disambiguation logicFrom the article, I was thinking that it was again a stupid confusing design for the cli to requires the -- even with a dedicated command.
One main issue with git is to not be consistent and logic with the comments. Always to use different way or option abbreviation for different command. For example having a space or a slash between repo and a branch in a command.
ls -file
ls "-file"
Both of these commands to ls will have an argv comprised of: ls, -fileActually, this one makes sense, once you understand the underlying model of how git works with remote repositories, which (imo) is fairly fundamental to a distributed VCS.
They're different arguments (in your words, having a space) when you're accessing remote repositories and have to specify the location it should access. You can always substitute an URL for a repo in this case, and they fail if you cannot connect to the remote repository.
In all other cases (having a slash), you're referencing a ref in your local repository. This is a local copy of the remote repository. That means that it always works offline, but also that it doesn't sync with the remote repository. You can also substitute another ref, such as a "local" branch.
git fetch origin main
git rebase -i origin/main
Git push origin localBranch:remoteBranch
For example, why not:
git push origin/remoteBranch localBranch
(And if you want to preserve saying that slash is just for local, you could say: origin:remoteBranch)