mirror of
https://codeberg.org/Codeberg/Documentation.git
synced 2026-06-17 22:03:51 -07:00
1.5 KiB
1.5 KiB
| eleventyNavigation | ||||||
|---|---|---|---|---|---|---|
|
Sometimes you will merge multiple commits into one. Maybe the commits are "dirty" full with not working code or embarrasing commit messages. This solution is only one of mutliple possible solutions. See this stackoverflow question for more details and variants.
Here is an example.
$ git log --graph --decorate --oneline
* cf634bb (HEAD -> master) english
* 722a9c7 zwei
* e59e6d0 eins
* c6990ba a
* 6dfc50b (origin/master, origin/HEAD) ix
* 10074d7 (tag: test) test
* 662e04e Initial commit
$ git status
Auf Branch master
Ihr Branch ist 4 Commits vor 'origin/master'.
(benutzen Sie "git push", um lokale Commits zu publizieren)
nichts zu committen, Arbeitsverzeichnis unverändert
You want to merge the last 4 commits from a to english.
$ git reset --soft "HEAD~4"
$ git status
Auf Branch master
Ihr Branch ist auf demselben Stand wie 'origin/master'.
Zum Commit vorgemerkte Änderungen:
(benutzen Sie "git reset HEAD <Datei>..." zum Entfernen aus der Staging-Area)
neue Datei: a
$ git commit --amend
[master 24e0e06] English
Date: Wed May 27 13:56:28 2020 +0200
2 files changed, 3 insertions(+), 1 deletion(-)
create mode 100644 a
$ git log --graph --decorate --oneline
* 24e0e06 (HEAD -> master) English
* 10074d7 (tag: test) test
* 662e04e Initial commit
After that you can push it to remote repository via git push.