'How do I read git synopsis documentation? [closed]
As an iOS engineer I struggle to understand the git documentation. I looked into the glossary and searched online but couldn’t find an answer to my question.
Example for git checkout: The documentation on it are as such:
1 git checkout [-q] [-f] [-m] [<branch>]
2 git checkout [-q] [-f] [-m] --detach [<branch>]
3 git checkout [-q] [-f] [-m] [--detach] <commit>
4 git checkout [-q] [-f] [-m] [[-b|-B|--orphan] <new_branch>] [<start_point>]
5 git checkout [-f|--ours|--theirs|-m|--conflict=<style>] [<tree-ish>] [--] <pathspec>…
6 git checkout [-f|--ours|--theirs|-m|--conflict=<style>] [<tree-ish>] --pathspec-from-file=<file> [--pathspec-file-nul]
7 git checkout (-p|--patch) [<tree-ish>] [--] [<pathspec>…]
☝️ I added line number myself
- I counted 7 lines. Is every line a combination of options that can work with any number of the options in that line? ie First line: the
git checkout [-q] [-f] [-m] [<branch>]can work with either-q,-f,-mindividually or-q -fcombined? yetgit checkout -q -bbranch won’t work because-bisn’t in that line? I mean The first three lines look very similar. - 1st and 2nd lines: Why couldn't the first 2 lines be replaced with this one line:
git checkout [-q] [-f] [-m] [--detach] <branch> - Also I suppose order isn't important that is for the first line,
git checkout -q -fis not different thangit checkout -f -q. I tried and the results were the same, but I'm just still not sure - 2nd line: why are some options in
[]but the--detachisn’t in a bracket? How is it different from 3rd line where--detachis inside[] - 4th line:
[[-b|-B|--orphan] <new_branch>]how should I read that? I have no clue - 5th line: what does
|mean? - 7th line: what is
()used? - 7th line: what’s with
[--]?
I understand the question may seem broad, but the different syntax commands need to be seen together.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
