versionsverwaltung:git

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
versionsverwaltung:git [2025/02/03 21:24] – [Pull Request (PR) erstellen] stversionsverwaltung:git [2025/03/30 22:15] (aktuell) – [Änderungen zurücknehmen] st
Zeile 168: Zeile 168:
  
   * lokale Änderungen zurücknehmen (wie svn revert): <code>git checkout PFAD_ODER_DATEI</code>   * lokale Änderungen zurücknehmen (wie svn revert): <code>git checkout PFAD_ODER_DATEI</code>
-  * Datei doch nicht committen: <code>git reset HEAD PFAD_ODER_DATEI</code>+  * Datei doch nicht committen: <code>git reset HEAD UNGEWOLLTER_PFAD_ODER_DATEI</code>Datei soll behalten werden aber aus dem commit gennommen werden (getestet):<code bash>git reset --soft HEAD~1 
 +git restore --staged UNGEWOLLTER_PFAD_ODER_DATEI 
 +# man kann sogar den gleichen commit wieder benutzen: 
 +git commit -c ORIG_HEAD 
 +</code> [[https://stackoverflow.com/questions/12481639/remove-file-from-latest-commit|andere Wege]]
   * letzte commit message ändern (öffnet Editor zur Änderung): <code>git commit --amend</code>   * letzte commit message ändern (öffnet Editor zur Änderung): <code>git commit --amend</code>
     * Falls der commit bereits an entfernte Repositories gesendet wurde ist die [[https://help.github.com/en/articles/changing-a-commit-message|Reparatur mit rebase und force push möglich]] (hat aber gravierende Auswirkungen auf Dritte)     * Falls der commit bereits an entfernte Repositories gesendet wurde ist die [[https://help.github.com/en/articles/changing-a-commit-message|Reparatur mit rebase und force push möglich]] (hat aber gravierende Auswirkungen auf Dritte)
Zeile 223: Zeile 227:
  
 ==== PGP signing ==== ==== PGP signing ====
 +
 +**Keymanagement**:
 +  * erstellen: <file>gpg --full-generate-key
 +gpg (GnuPG) 2.2.20; Copyright (C) 2020 Free Software Foundation, Inc.
 +This is free software: you are free to change and redistribute it.
 +There is NO WARRANTY, to the extent permitted by law.
 +
 +Please select what kind of key you want:
 +   (1) RSA and RSA (default)
 +   (2) DSA and Elgamal
 +   (3) DSA (sign only)
 +   (4) RSA (sign only)
 +  (14) Existing key from card
 +Your selection? 1
 +RSA keys may be between 1024 and 4096 bits long.
 +What keysize do you want? (2048) 4096
 +Requested keysize is 4096 bits
 +Please specify how long the key should be valid.
 +         0 = key does not expire
 +      <n>  = key expires in n days
 +      <n>w = key expires in n weeks
 +      <n>m = key expires in n months
 +      <n>y = key expires in n years
 +Key is valid for? (0)
 +Key does not expire at all
 +Is this correct? (y/N) y
 +
 +GnuPG needs to construct a user ID to identify your key.
 +
 +Real name: Stefan Schwarz
 +Email address: stefan.schwarz@domain.tld
 +Comment:
 +You selected this USER-ID:
 +    "Stefan Schwarz <stefan.schwarz@domain.tld>"
 +
 +Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O
 +We need to generate a lot of random bytes. It is a good idea to perform
 +some other action (type on the keyboard, move the mouse, utilize the
 +disks) during the prime generation; this gives the random number
 +generator a better chance to gain enough entropy.
 +We need to generate a lot of random bytes. It is a good idea to perform
 +some other action (type on the keyboard, move the mouse, utilize the
 +disks) during the prime generation; this gives the random number
 +generator a better chance to gain enough entropy.
 +gpg: key 3DD879D552CC995F marked as ultimately trusted
 +gpg: directory '/home/USER/.gnupg/openpgp-revocs.d' created
 +gpg: revocation certificate stored as '/home/USER/.gnupg/openpgp-revocs.d/CFEF13CC5040450E63CC1BC43DD879D552CC995F.rev'
 +public and secret key created and signed.
 +
 +pub   rsa4096 2025-02-03 [SC]
 +      CFEF13CC5040450E63CC1BC43DD879D552CC995F
 +uid                      Stefan Schwarz <stefan.schwarz@domain.tld>
 +sub   rsa4096 2025-02-03 [E]</file>
 +  * anzeigen: <code bash>gpg --list-secret-keys --keyid-format=long</code> <file> Ausgabe:
 +gpg: checking the trustdb
 +gpg: marginals needed: 3  completes needed: 1  trust model: pgp
 +gpg: depth: 0  valid:    signed:    trust: 0-, 0q, 0n, 0m, 0f, 1u
 +/home/USER/.gnupg/pubring.kbx
 +-------------------------------
 +sec   rsa4096/3DD879D552CC995F 2025-02-03 [SC]
 +      CFEF13CC5040450E63CC1BC43DD879D552CC995F
 +uid                 [ultimate] Stefan Schwarz <stefan.schwarz@domain.tld>
 +ssb   rsa4096/57EC66B3C0D405F5 2025-02-03 [E]</file>
 +  * testen: <code bash>echo "test" | gpg --clearsign</code>
 +  * Pubkey anzeigen: <code bash>gpg --armor --export 3DD879D552CC995F # kurze ID</code>
 +  * Backup des private keys: <code bash>gpg --export-secret-keys --armor CFEF13CC5040450E63CC1BC43DD879D552CC995F > ~/pgp-signing-3DD879D552CC995F.key # lange ID</code>
  
   * pgp-signing in git aktivieren:   * pgp-signing in git aktivieren:
Zeile 228: Zeile 298:
     * <code bash>git config --global user.signingkey 3DD879D552CC995F # KurzID</code>     * <code bash>git config --global user.signingkey 3DD879D552CC995F # KurzID</code>
     * :!: Auf dem git-server muss noch im Benutzerprofil der pubkey hinterlegt werden.     * :!: Auf dem git-server muss noch im Benutzerprofil der pubkey hinterlegt werden.
-  * anzeigen: <code bash>gpg --list-secret-keys --keyid-format=long</code> 
-  * testen: <code bash>echo "test" | gpg --clearsign</code> 
- 
-**Keymanagement**: 
-  * Pubkey anzeigen: gpg --armor --export 3DD879D552CC995F # kurze ID 
-  * Backup des private keys: gpg --export-secret-keys --armor CFEF13CC5040450E63CC1BC43DD879D552CC995F > ~/pgp-signing-3DD879D552CC995F.key # lange ID 
- 
  
 +Quelle: https://endjin.com/blog/2022/12/how-to-sign-your-git-commits
 === Fehlerbehandlung === === Fehlerbehandlung ===