Questions tagged [git-amend]
Parameter of git-commit command that adds the current staging area to the last commit and allows you to (by default) edit previously used commit message or (if other options were given) reuse it or even discard it and write a new one.
git-amend
149
questions
-1
votes
1
answer
57
views
git: commit amend created parallel commits
Using PHPStorm's interface, I committed five files and pushed to GitHub (I'm the only developer - I just use GitHub as a sort of backup). Then I realized a little more clean-up was needed on one of ...
0
votes
2
answers
125
views
How to remove personal email from git commits after PR has been merged?
On GitHub I've successfully opened a PR on a public repository, which has been recently merged:
My Pull Request (#25)
* Feature 1
* Feature 2
* Bump version
---------
Authored-by: My Username <my....
1
vote
0
answers
46
views
Bizarre behavior when I amend a commit [duplicate]
I hope someone can tell me what Git is doing to me.
First, a caution: the stuff in this repo is totally proprietary.
I doubt that I could sanitize it without changing it so much that the problem goes ...
0
votes
0
answers
13
views
Changing git commit author
Asking this question now because I could not find a discussion for this exact issue.
Ever since the new year, I realized none of my commits on github were tracking after switching to linux, and I saw ...
0
votes
1
answer
50
views
How to amend last commit without losing commit tag [duplicate]
I have a commit with a tag, but when I amend any changes to it, it loses the tag.
I am not new to git, but still can't understand how it works
I've tried:
git commit --amend --no-edit
git commit --...
0
votes
0
answers
48
views
How to make Git automatically retain committer date for `git commit --amend`?
I am aware of Git picking up the GIT_COMMITTER_DATE environment variable, but for every amending commit, I have to manually prepend GIT_COMMITTER_DATE="$(git log -1 --pretty=tformat:%cD HEAD)&...
-2
votes
1
answer
822
views
git commit --amend not opening a new tab in VS Code [duplicate]
I used to use git commit --amend and it used to open a new tab in VS Code where I can edit the commit and when I close this tab the commit is changed, but for some reason this doesn't happen any more.
...
1
vote
2
answers
81
views
Can I decide in Git that the last commit is pushed?
I have a workflow as following:
during development, I often commit (locally) regardless whether I have reached any milestone, just for backing up and being able to recover if development goes towards ...
1
vote
0
answers
194
views
Why I am getting a branch conflict every time I try to amend/commit to my personal repo?
I am using GitHub for the first time and I've spent past few days trying to wrap my head around basic git functionality and commands. Currently, my repository is private–I am the only person using it ...
1
vote
1
answer
120
views
How to access amended commit in Jenkins?
I use a custom trigger that scans for changes in repository and starts the builds when needed. It is a Jenkinsfile with some helper gradle scripts on the side.
The core of functionality that checks ...
0
votes
1
answer
46
views
How do you add to the last commit message when running git commit --amend
not sure if you can do this but I am looking for the Syntax / Placement to add a new message when editing a commit via git commit --amend
I am aware that you can overwrite a message via git commit --...
0
votes
1
answer
3k
views
Local branch and remote branch have diverged after amending commit
I have a feature branch called featureA and I am the only developer who is and will be touching this branch until it gets merged to master branch.
My git command history is:
committed changes locally
...
0
votes
1
answer
36
views
Is it safe to push amend on private branch
Say I am the sole developer working on a branch. I push and immediately see the wrong message which I want to fix with amend. I know when others are working it can easily do a lot of trouble.
But if I ...
0
votes
1
answer
578
views
git amend: Commit not amended
I see a bit strange behavior with Git.
So I have a feature branch locally, say F1, and I add a commit, C1, to it. I push it to repo, get reviews and finally merge to master. So master has my commit C1 ...
2
votes
1
answer
292
views
In pre-commit hook, find hash of the parent of the commit that's being created
I have some tests in my pre-commit hook which require the hash of the previous commit to work.
By previous commit I mean the one that will become the parent of the commit that's being created right ...
0
votes
1
answer
76
views
Undo git commit message in 2 different branches (develop and feature) after git push
do not want to break anything in the master branch.
I forked a develop branch through below commands
git checkout develop
git pull upstream develop # pull the updates locally based on the
git push ...
2
votes
1
answer
64
views
Quick, small, casual git rebase for only one or a few hunks: any facility?
I'm in the process of editing my source files to produce a new commit atop my dev branch. My changes are saved on disk but not yet staged.
Then I notice a small mistake introduced by a former commit, ...
0
votes
1
answer
4k
views
How to revert to a previous version of a commit?
I made some mistakes in my amended commits and would like to revert back to a previous version of the commit. I usually just manually do this by manually recreating the previous state, but I would ...
0
votes
1
answer
136
views
TortoiseGit amend merge commit: "show diff to last commit" checkbox is disabled
I'm trying to commit --amend to a merge commit with TortoiseGit 2.13.0.1.
For a repository where the last commit is a merge commit, the "show diff to last commit" checkbox is disabled (...
1
vote
1
answer
824
views
git: change a commit and delete the old one
I would like to modify the current git commit and remove its previous form. In other words the "old" current commit has to disapper and it is replaced by the "new" one with the ...
17
votes
1
answer
27k
views
amending a commit after it has been pushed [duplicate]
In my most recent commit to my repository that has already been pushed, I noticed I misspelled a single word in a file and now would like to change it. However, I do not want to create a whole new ...
0
votes
1
answer
170
views
What to do when force pushing is denied by remote hub?
Okay, so this is a question after the fact, and I just want to know what I should've done so I can avoid this problem in the future. Yes, I realize force pushing is a dangerous command. Yes, I realize ...
0
votes
2
answers
497
views
Prevent git commit --amend from trying to amend an already submitted change?
We are using Gerrit for code reviews.
The normal workflow is:
git commit
run a script to push the commit, which does:
git commit --amend, which I think triggers a hook
git push
Every now and then, ...
1
vote
2
answers
8k
views
Amend previous commit with no change to commit message
I had already pushed some changes to a remote. Now I need to push some other changes which should be in that previously pushed commit but somehow are not. I can do this simply by pushing the changes ...
1
vote
1
answer
672
views
why does github show current date instead of real date of an ammended commit?
I amended a commit in a github repository (wrong version in a Changelog file) some days later after the commit was pushed. When I do a git log I see that the amended commit still has the date of the ...
0
votes
0
answers
639
views
Reset name and email for commits on GitHub without changing date
Like so many others, I have committed to a repository with the wrong name and email.
While there are A LOT of posts and solutions on how to correct these informations and some to preserve the date, I ...
0
votes
1
answer
267
views
How to properly maintain one commit per feature branch strategy in a GIT workflow?
In a project I am working on, we have workflow of one commit per feature branch. If I have not to make any subsequent changes after a commit, then it is fine, but if after a commit, and which has been ...
1
vote
1
answer
175
views
Cannot git merge because git commit --amend
In master branch, I have the Initial Commit pushed gitlab
After that I create a new branch called "branchA"
I rename the initial commit with
git commit --amend -am Initial Commit v2
and do ...
1
vote
1
answer
2k
views
How can i revert a git commit --amend -m without losing my original hashcode and the code i supposed to commit?
I need to revert a wrong git commit --amend -m
did git commit without -m
did git commit --amend -m "commit message"
git commit --amend -m "commit message" changed my previous ...
0
votes
1
answer
2k
views
fatal: --author 'First Last [email protected]' is not 'Name <email>' and matches no existing author
I ran into this error when trying to amend a commit to change the author.
git commit --amend --author="First Last [email protected]"
fatal: --author 'First Last [email protected]' is ...
0
votes
1
answer
816
views
Bitbucket - Single commit for all the commit's
I am currently using BitBucket as version control for my project. I see different node (In the image with black dots/multiple commits) of Branch graph on multiple commits. How can I make sure only one ...
17
votes
5
answers
13k
views
How do I add a co-author to latest pushed git commit?
I need to add a co-author to my last commit and I tried using git commit --amend --author="name <[email protected]>" but change --author to --co-authored-by. I thought this would be an ...
1
vote
1
answer
954
views
Recover commit lost during commit amend
I've made a mistake I guess
Yesterday I created a new branch (feature/crud-suppliers), then yesterday and today I worked on that branch.
30 minutes ago, after I finished my changes I added the files ...
40
votes
2
answers
36k
views
Can I amend a commit made with VSCode to GitHub repo?
I learn Git and Using VSCode and just learn the commit "amend" command and now trying it on origin (GitHub).
I can't find any way to do this. Do I need some external tool to do that I don't ...
0
votes
1
answer
59
views
amending a commit to add a file, cause orphan branches
Based on the following git scenario:
C0 (master)
\
\
C1-------------C5 (develop)
\ /
\ /
C2--C3--C4 (feature)
I have a new uncommitted file that ...
0
votes
3
answers
5k
views
I have two git commits that appear the same after a pushed amend
I have a git branch that I am working on locally. After editing some code and doing a commit and a push to a remote repo, I noticed that I had an error in my commit message. I used amend to correct ...
-2
votes
1
answer
479
views
Git - Adding more changes to an old commit
I have a git branch called 'AAA'. I made my initial commit & created a pull request of this branch yesterday. But today after reviewing comments, I have to do some changes to my code.
I done the ...
1
vote
1
answer
157
views
Git commit with broken date
I've got an issue with a commit in a Git repo (It's big, and old), the commit in question was apparently committed on 1 Jan 2138, which is clearly wrong. As far as I know it should be 1st Oct 2019. ...
2
votes
2
answers
578
views
Git commit --amend alias hangs
I have this alias in my ~/.gitconfig:
[alias]
am = commit -a --amend -C HEAD
Yet, when I run git am, it hangs, and I get (master|AM/REBASE) at the prompt, and I have to run git am --abort.
0
votes
1
answer
637
views
Amended commits revert to previous commit
I have a repo with master branch. I have patch-sets 1 to 10 amended in a single commit. Now I have amended the 11th patch-set in that commit and pushed the code in gerrit. I want to revert the commit ...
2
votes
1
answer
696
views
Git alias with multiple command
After a review, i need to change some code and repush all my change code on the remote branch.
So i would like to automate on git with an alias (ex: git repushall) these different commands:
git add ....
1
vote
0
answers
185
views
GIT: How to edit/reword a commit message, while keeping the fastforward history of branches
I have a fast-forwarded repo history with branches, representing server upgrade states.
branch2
|
commit4
|
commit3
|
branch1
|
commit2
|
commit1
|
initial commit
If I rebase from commit1 to reword ...
1
vote
1
answer
180
views
Sync other branch when amending commit in current branch
I have to branches, A and B:
1-2-3
^ ^
A B
Say I want to amend commit 2, so I checkout branch A and do git commit --amend.
Now my graph looks like this:
1--2' [A]
\-2-3 [B]
Is there a way ...
3
votes
3
answers
3k
views
git - fatal: your current branch appears to be broken (possibly from interrupted pull)
Problem:
accidentally did a git --amend and pushed it to a usb key from first computer
pulled from the usb key to a second computer
second computer repository is now corrupted
git pull to first ...
0
votes
1
answer
172
views
Merge changes in ammended commit from remote branch?
I currently have a PR open on a repo where the maintainer prefers to have all PR's as a single commit. This heavily effects my workflow when making changes on request from the maintainer. I have a ...
0
votes
1
answer
40
views
How do I find all commits with a certain message and squash them into the previous commit?
When I've been coding I often use git commit -am <message> to save my work, and occasionally I'll use git commit --amend if I made a mistake in the previous commit. Recently I thought I was ...
0
votes
1
answer
119
views
Amend commit while splitting in rebase
Sometimes I accidentally amend the previous commit with the changes I want to make to the one before that, i.e. HEAD~1. I usually go into rebase interactive mode with git rebase -i, split the commit ...
1
vote
2
answers
219
views
Is `git commit --amend` touching more files than is necessary?
I often experience the following:
Modify files A, B, and C.
Commit the modifications with git commit.
Build the project, so the build is up to date.
Make a follow-up / fix-up modification to file A ...
0
votes
3
answers
482
views
Change a commit pushed to GitHub... removing files
Git twists my brain. But I think I'm halfway there with this problem.
I committed (twice) and pushed to GitHub, but the first commit contained two files that should not have been included. So I ...
0
votes
0
answers
218
views
How can I GIT REWORD from the command line?
Is there a way to reword a git commit message from command line? Something like
git commit --amend --message="New message"
Similar as we can change author name via git commit --amend --author="New ...