Last active
May 2, 2023 17:27
-
-
Save malefs/bb726374d5ce7e1f387e0e9db20160ab to your computer and use it in GitHub Desktop.
git howtos
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Repo anlegen auf gitserver | |
| mkdir name.git | |
| cd name.git | |
| git --bare init | |
| git init | |
| chown -R git:git name.git/ | |
| --------------------------------------------- | |
| lokales vorhandenes repo diesem zuweisen | |
| git remote add origin name.git | |
| git remote add origin git@192.168.2.12:/home/git/name.git | |
| ------------------------------ | |
| repo vom gitserver clonen | |
| git clone git clone git@192.168.2.12:/home/git/name.git optional checkoutname | |
| git remote show origin #ausgechecktes Repo Herkunft ausgeben | |
| git remote -v | |
| ------------------------------ | |
| git add <dateiname> | |
| git add R/modified.R man/modified.Rd | |
| git add * | |
| git status | |
| git diff | |
| git commit -m "Commit-Nachricht" | |
| git commit -a //Add everything and commit | |
| git pull | |
| Change "origin" of your GIT repository | |
| $ git remote rm origin | |
| $ git remote add origin git@github.com:aplikacjainfo/proj1.git | |
| $ git config master.remote origin | |
| $ git config master.merge refs/heads/master | |
| git push -u origin master | |
| error: Fehler beim Versenden einiger Referenzen nach 'git@192.168.2.12:/home/git/rekutherm.git' | |
| Hinweis: Aktualisierungen wurden zurückgewiesen, weil die Spitze Ihres aktuellen | |
| Hinweis: Branches hinter seinem externen Gegenstück zurückgefallen ist. Führen Sie | |
| Hinweis: die externen Änderungen zusammen (z. B. 'git pull ...') bevor Sie "push" | |
| Hinweis: erneut ausführen. | |
| Hinweis: Siehe auch die Sektion 'Note about fast-forwards' in 'git push --help' | |
| Hinweis: für weitere Details. | |
| Abhilfe: | |
| git pull --rebase origin master | |
| git push -u origin master | |
| To remove a submodule you need to: | |
| Delete the relevant section from the .gitmodules file. | |
| Stage the .gitmodules changes git add .gitmodules | |
| Delete the relevant section from .git/config. | |
| Run git rm --cached path_to_submodule (no trailing slash). | |
| Run rm -rf .git/modules/path_to_scommubmodule (no trailing slash). | |
| Commit git commit -m "Removed submodule " | |
| Delete the now untracked submodule files rm -rf path_to_submodule | |
| git submodule init | |
| git submodule update | |
| https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration | |
| git config --global user.email "you@example.com" | |
| git config --global core.editor emacs nano ... | |
| warning: 'push.default' ist nicht gesetzt | |
| git config --global push.default matching | |
| git config --global push.default simple | |
| ------------------------------ | |
| Git Repo zurücksetzen | |
| git fetch --all | |
| git reset --hard origin/master | |
| git reflog | |
| #zeigt liste der Commits | |
| 39ca05a (HEAD -> master, origin/master, origin/HEAD) HEAD@{0}: reset: moving to origin/master | |
| 17f673c HEAD@{1}: commit: filterupdate | |
| 7c7b517 HEAD@{2}: commit: filterupdate | |
| 9bf3177 HEAD@{3}: commit: testgitlab | |
| 39ca05a (HEAD -> master, origin/master, origin/HEAD) HEAD@{4}: commit: testgitlab | |
| git reset --hard 17f673c #setze auf Head zurück | |
| mit git fetch werden zunächst die verfügbaren Dateien aus dem remote repository geladen. Der Befehl git reset sorgt dann dafür, dass der master branch mit den “gefechten” Dateien wiederhergestellt wird. Die Option --hard origin/master sorgt dafür, dass lokal geänderte Dateien überschrieben werden - Lokale Änderungen sind damit auch anschließend verloren | |
| https://jigarius.com/blog/multiple-git-remote-repositories | |
| https://git-scm.com/book/de/v2/Git-Tools-Stashen-und-Bereinigen |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment