
kskaradzinski
Gibt es einen Befehl, der mir eine Liste aller verfügbaren Befehle in GIT anzeigen kann? Es gibt git help
aber es zeigt:
usage: git [--version] [--exec-path[=<path>]] [--html-path]
[-p|--paginate|--no-pager] [--no-replace-objects]
[--bare] [--git-dir=<path>] [--work-tree=<path>]
[-c name=value] [--help]
<command> [<args>]
The most commonly used git commands are:
add Add file contents to the index
bisect Find by binary search the change that introduced a bug
branch List, create, or delete branches
checkout Checkout a branch or paths to the working tree
clone Clone a repository into a new directory
commit Record changes to the repository
diff Show changes between commits, commit and working tree, etc
fetch Download objects and refs from another repository
grep Print lines matching a pattern
init Create an empty git repository or reinitialize an existing one
log Show commit logs
merge Join two or more development histories together
mv Move or rename a file, a directory, or a symlink
pull Fetch from and merge with another repository or a local branch
push Update remote refs along with associated objects
rebase Forward-port local commits to the updated upstream head
reset Reset current HEAD to the specified state
rm Remove files from the working tree and from the index
show Show various types of objects
status Show the working tree status
tag Create, list, delete or verify a tag object signed with GPG
See 'git help <command>' for more information on a specific command.
Und ich möchte nur eine Liste ohne Beschreibung.
Wie @CharlesBailey bereits vorgeschlagen hat, git help -a
ist eine großartige Möglichkeit, alle Unterbefehle aufzulisten, die git anbietet. Wenn Sie jedoch einige der von Git gedruckten Formatierungen entfernen möchten, können Sie dies auch tun:
Der einfachste Weg, um eine Liste aller Git-Unterbefehle zu erhalten, ist wie folgt:
git help -a | grep "^ [a-z]" | tr ' ' '\n' | grep -v "^$"
Dies dauert die Ausgabe von git help -a
wählt nur die eingerückten Zeilen aus, wandelt Leerzeichen in Zeilenumbruchzeichen um und entfernt dann die leeren Zeilen.
Warum willst du so etwas? Ein häufiger Grund, die Unterbefehle eines Befehls aufzulisten, ist die Aktivierung der automatischen Vervollständigung in Bash:
complete -W "$(git help -a | grep "^ [a-z]")" git
Jetzt, wenn Sie tippen git br
und drücke TAB
es wird automatisch vervollständigt git branch
. Genießen!
Wenn Sie Linux (BASH) verwenden. Du kannst es versuchen
`$ git [TAB] [TAB]`
Dann habe ich so etwas bekommen:
$ git
add fetch rebase
am fetchavs reflog
annotate filter-branch relink
apply format-patch remote
archive fsck repack
bisect gc replace
blame get-tar-commit-id request-pull
br grep reset
branch gui revert
bundle help rm
checkout imap-send shortlog
cherry init show
cherry-pick instaweb show-branch
ci log st
citool log1 stage
clean merge stash
clone mergetool status
co mv submodule
commit name-rev svn
config notes tag
describe pull whatchanged
diff push
difftool pushav
Zum Auflisten von Git-Befehlen, einschließlich Git-Befehlen, die an anderer Stelle in Ihrem $PATH verfügbar sind
git help -a
Um benutzerkonfigurierte Aliase aufzulisten, verwenden Sie
git aliases
Quelle: https://thenucleargeeks.com/2020/01/20/git-commands-cheat-sheet/
Windows: Use Chocolatey and in powershell type
choco install git
Linux:
ubuntu: sudo apt-get update && sudo apt-get install git -redhat: sudo yum install git -h
Mac OS:
install Homebrew and Xcode
Set a user name which can be seen or associated with every commit
git config --global user.name "nuclear geeks"
Set a user email which can we seen or associated with every commit
git config --global user.email "nucleargeeks18@gmail.com"
Clone an existing repository
git clone url
Check the modified file in working directory.
git status
Add a modified file to staging area.
git add <file_name>
Add all the modified file to staging area
git add .
Commit message
git commit -m "commit_message"
Difference between working area and staging
git diff <file_name>
Difference between working area and last commit or repository
git diff HEAD <file_name>
Difference between staging area and repository
git diff --staged
git diff --staged <file_name>
List all your branches
git branch
Create new branch
git checkout -b <branch_name>
Push the branch to origin
git push origin <branch_name>
Switch to another branch
git checkout <branch_name>
Merge branches
git merge <branch_name>
Backout File, If you want to move your file from stage area to working or unstage area
git reset HEAD <file_name>
Discard changes in working directory
git checkout <file_name>
Delete file
git rm <file_name>
Rename a file
git mv <current_name> <new_name>
Move a file
git mv <file_name> <dir_name>
Git alias, renaming command to new name
git config -global alias. <short_command> <"long command">
Find hidden file
git ls -al
Stash your changes
git stash
To apply your changed from stash
git stash apply
To delete your stash from the list
git stash drop
To list your stash list
git stash list
To apply the changes and delete from the listt
git stash pop
Git stash with message
git stash save "msg"
Find change done in specific index
git stash show stash@{id}
Apply
git stash apply stash@{id}
Tag creation
git tag <tag_name>
Annotated tag creation
git tag -a <tag_name>
Push tag to remote
git push origin <tag_name>
List all the tags
git tag --list
Delete tags
git tag --delete <tag_name>
Create a branch from the tag
git checkout -b <branch_name> <tagname>
Create a tag from past commit
git tag <tag_name> <reference_of_commit>

VonC
Mit Git 2.36 (Q2 2022), “git help -a
“(Mann) hat neue Optionen, die helfen, die Liste der Befehle zu filtern/zu klären.
Sehen Commit 93de1b6, Commit 1ce5901, Commit 503cdda, Commit 5e8068b, d7f817d übergeben, 6fb427a übernehmen, begehen Sie bf7eed7, cd87ce7 übergeben, 4bf5cda begehen (21. Februar 2022) von Ævar Arnfjörð Bjarmason (avar
).
(Zusammengeführt von Junio C. Hamano — gitster
— in übertrage 1f3c5f309.03.2022)
help
: addieren --no-[external-commands|aliases]
zum Gebrauch mit --all
Unterzeichnet von: Ævar Arnfjörð Bjarmason
Fügen Sie die Möglichkeit hinzu, nur gits eigene Nutzungsinformationen unter auszugeben --all
.
Dies ermöglicht uns auch, die zu verlängern "test_section_spacing"
Tests, die in einem vorherigen Commit zu Test hinzugefügt wurden “git help --all
“(Mann) Ausgang.
Bisher konnten wir das nicht tun, da die Tests möglicherweise einen git-*-Befehl im “$PATH” finden, wodurch die Ausgabe von einem Setup zum anderen unterschiedlich wäre.
git help
schließt jetzt in seine ein Manpage:
'git help' [-a|--all] [--[no-]verbose] [--[no-]external-commands] [--[no-]aliases]
git help
schließt jetzt in seine ein Manpage:
--no-external-commands
Bei Verwendung mit --all
schließen Sie die Auflistung von externen “git-*
” Befehle gefunden in der $PATH
.
--no-aliases
Bei Verwendung mit --all
schließen Sie die Auflistung konfigurierter Aliase aus.

Sandeep Kumar
Befehl zum Klonen der URL: git clone url
Befehl zum Überprüfen des Status: git status
Befehl zum Hinzufügen einer Datei: git add pom.xml
git add src/
Befehl zum Festschreiben von Code mit Nachricht: git commit -m "initial version"
Befehl zum Drücken: git push -u origin master
Befehl zum Löschen des Git-Terminals: clear
Befehl zum Auschecken eines anderen Zweigs: git checkout -b branch-name
Befehl zum Hinzufügen einer Datei: git add src/main/java/com/rest/mongo/UserExample.java
Befehl zum Abrufen von Updates aus einem anderen Zweig: git pull origin develop
Befehl zum Durchdrücken stromaufwärts: git push --set-upstream origin 11111feature-234
Schritte zum Zusammenführen Ihres Zweigs mit dem Entwicklungs-/Master-Zweig: git checkout -b develop
git merge your-branch-name
als Referenz verwenden Sie den folgenden Link: (Schritt-für-Schritt-Erklärung)
https://www.youtube.com/watch?v=tzZj-bnjX6w&t=17s
9945700cookie-checkgit listet alle verfügbaren Befehle aufyes