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.

New commit!

Using this option effectively creates new commit! It replaces current tip of the branch, so if you use it on anything that's NOT the tip (checking out a tag or SHA and then amending) you're effectively branching (feel free to check with logs).

It's considered a rough equivalent of

  • soft reset,
  • manual changes
  • and committing on top of ORIG_HEAD.

Trivia

  1. You may also use it to amend a merge commit.
  2. Using --reset-author with --amend you also reset author and author timestamp.

More:

git help commit

146 questions
0
votes
2 answers

Amending comments in GIT

I have done my code development in my local branch and added commit comments as shown ( temporary, temp2) thinking that I can rebase and amend the commit message before pushing to remote repository. But after these two commits I pulled from a remote…
kernel
  • 326
  • 1
  • 3
  • 18
0
votes
2 answers

git amend added files in the staging area too

I had changed a lot of files and added them in the Git staging area. Then, before committing them, I realised that I had to change the commit message of the previous commit. So, I did a git commit --amend and changed the commit message without going…
darkryder
  • 792
  • 1
  • 8
  • 25
0
votes
1 answer

EGit after "Amend previous commit" removed pushed code is back

I have the following Git log.: I have used the EGit "Amend previous commit" function to change the commit message for commit with message "Remove unused function addSubinterval before", that I have already pushed to the Git server to "Remove unused…
BuZZ-dEE
  • 6,075
  • 12
  • 66
  • 96
0
votes
1 answer

Why i can't use comand "git commit --amend" and push that to github

firstly I cloned my own repo from github, because i wanna amend the last commit, so i type "git commit --amend" and push to github, but some errors occur. Some guys said that the operation doesn't allowed by github, unless make another commit, Is…
yzycqu
  • 35
  • 4
0
votes
1 answer

How to perform a subtree merge using plumbing commands?

I want to combine a subtree merge into a regular (non-merge) commit. I currently do this by first performing the subtree merge, then amending this with the regular changes. git merge --strategy subtree --strategy-option subtree=subdir…
Brecht Machiels
  • 3,181
  • 3
  • 25
  • 38
0
votes
1 answer

how the git commit --amend working together with gerrit?

I staged and committed 5 files and pushed it gerrit, but before it is merged in to git, I updated 3 of them then I git commit --amend to the last commit, and if I do push to gerrit again, does this second path contains the updates in the other two…
user2131316
  • 3,111
  • 12
  • 39
  • 53
-1
votes
1 answer

Modifying last n commits and appending a line to all of them through hook

I have a local code-review process wherein a reviewer adds an empty commit on top of a branch that its been reviewed and send s back to developer. The developer then pushes it to canonical. I want to write a pre-push hook which will see if last…
Mudassir Razvi
  • 1,783
  • 12
  • 33
-1
votes
1 answer

Git --amend in Eclipse JAVA

I tried to Push some files in git For example a,b,c,x,y,z files.. I did commit ammends after i found some mistakes int he files... I did commit amend for same files and pushed same files a,b,c,x,y,z After Some commits I realized that , i dont want…
Knowit09
  • 21
  • 4
-2
votes
1 answer

git commit --amend not opening a new tab in VS Code

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. Now when I use git commit --amend it doesn't…
-2
votes
1 answer

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 changes. Then I looked at remote repository commit…
-3
votes
1 answer

Git stage and amend with one command

Currently I am doing this to amend my changes to the most current commit: $ git add . $ git commit --amend Is there a way to stage and amend in one command?
Minjun Yu
  • 3,497
  • 4
  • 24
  • 39
1 2 3
9
10