Does git commit --amend include the files that were in the last commit?
The git book seems to contradict itself re
git commit --amend:
This command takes your staging area and uses it for the commit. If you’ve made no changes since your last commit..., then your snapshot will look exactly the same and all you’ll change is your commit message.
First it says, "This command takes your staging area and uses it for the commit."
Now, if I run
git add -A; git commit -m "Initial"; git status; the status message says the staging area is empty.
Then the book says, "If you've made no changes since your last commit ... your snapshot will look exactly the same..."
Now, if it uses my (empty) staging area for the commit, shouldn't the amended commit be empty? The amended commit isn't empty though, it includes the files that were in the last commit.
It seems that the git book should read:
This command takes your staging area, adds it to the last commit, and creates a new commit from the combination...
Please help me out here. What, if anything, am I missing?
I have a Git repository with dozens of commits. I want the last commit to be the only commit - meaning the repository would behave as if it was just initialized and the current file state is the only
Until a minute ago, I had a Git repo where the last commit had an empty commit message. I've filled it in by squashing a new commit onto it with git rebase -i (I was planning to amend the contents any
Often during a commit($git -commit -m ) I would wish to read my last comment to remember what progress I have made. Is there an easy way to directly access the last commit message through cmd line?
I want to find out the last thing that I pushed, no the last thing i commited, but pushed. Is there a git command for this? Context: I want to squash some commits before merging my dev_branch with a
I want to see all the files that were committed in a particular commit in git, how do I do that?
I just noticed when I tried to amend a commit that there is no git commit amend function in Aptana Studio 3. Is that correct or am I missing something? If it is indeed not there, does anyone in the co
I know how to add and commit one file: git add [file name] and git commit -m but what about if I have many file in different dir. how is the right way to do it? Thanks.
I wanted to modify the commit message on a commit I just made, so I tried to do: git commit --amend (as I normally do), but I got an error: Unable to find modified files; please check git status Now
I did a git commit -m message like this >git commit -m save arezzo files # On branch master # Changes not staged for commit: # (use git add <file>... to update what will be committed) #
I can make a commit with git with the following command: git commit -a However then I have to enter the comment with VIM. Id rather do it all with one command so ive tried the following: git commit -
Suppose I have a file mocky.cpp, I would like to list commits that modified the file, and also list another files that were touched by these commits. So I try the following: git log --name-only -- moc
I'd like to amend my last commit, but running hg commit --amend gives me abort: cannot amend public changesets even though I know that it's safe to edit the changeset. How can I change the phase of
There are multiple questions on Stack Overflow addressing the problem of staging and committing only parts from files. However, I can't make it work. How can I commit only part of a file in git Let'
i am trying to commit changes to a project in Xcode 4.6.3 i have used the Source Control -> Commit mechanism several times and it worked beautifully i recently added DCRoundSwitch objects to my pro
When I try to do a git commit -a, I get a nice vim instance. I type in my message, do :wq, vim closes down and the terminal has the message, Aborting commit due to empty commit message. Pursuant to
Is there any git command to fetch an intermediate commit, just like 'svn co -r xxx' works? Thanks!
Other than parsing git log for the date string, is there a Git native way to report the date of a certain commit?
I added a .gitignore file after git add .. I'd like to know if I can proceed to git commit and push it and git will ignore the files. If not how should I delete the files which I git added. Where does
I would like to check commit message before git commit. I use pre-commit hook to do that, but couldn't find the way to get commit message in .git/pre-commit script. How could I get it?
I am using Git Bash and am trying to figure out what is happening when I type 'git commit -a'. Looks like VIM opens up to edit my commit message but how do I save and actually complete this commit? I
Commit hooks in git live in the .git/hooks directory. What I would love is be able to commit those hooks so everyone checking out the repo has the hooks automatically. I'm not able to add the files in
Consider I have commits ... -- A -- B -- C If I use git rebase -i to squash all three commits into one, we could pick A squash B squash C I see the resulted commit A has its original timestamp. How
I have the hash for a git commit I made a few weeks ago. I tried checking it out but it says that the hash did not match any file(s) known to git. I also looked for it in git reflog, but don't see i
Is it redundant to run git add . and then git commit -am commit message? Can I just run git add . and then git commit -m commit message or, alternatively, just git commit -am commit message?
I made a commit & pushed to repo. Later I modified the commit message by using git commit --amend, In the pop-up window I entered the new message. I could see the new message via git log. After al
I lost my last commit because I accidentally ran git reset --hard HEAD^. Note: I didn't want to put the ^ at the end. Is there any way to get it back? It was 2 days of work :(
I don’t understand git commit at all. It’s been a week since I’ve been using git and all these git with –a, -m, new files, untracked etc is making me totally confused. Tortoisegit is saving me for th
I want to have a simple git post-commit action that prints the date of the last time you pushed your changes to each remote. The motivation for this is a simple reminder of how far out of sync your re
For some reason, I thought that doing: git commit -a -m commit something here the -a part would already ADD files, but I was wrong (by fact, because it means ALL and not ADD) and by example (becaus
If you found a bug in your last commit, you can simply recommit the last commit with git commit --amend But if you already committed another commit, how do you resubmit the commit before that one? No
I'm looking at a git hook which looks for print statements in Python code. If a print statement is found, it prevents the git commit. I want to override this hook and I was told that there is a comma
I used git init to create a fresh repo, then made three commits. Now I want to rebase to go back and amend my first commit, but if I do git rebase -i HEAD~3 it complains! If I try the same with HEAD~2
I recently started working on a project with a huge code base. I decided to create a local git repo to keep track of all my changes. Rather than downloading all the project's existing files and adding
Possible Duplicate: Can I skip the commit message step when I run git commit --amend? Is there a way to do a git commit --amend that automatically uses the old commit message instead of prompting us
Scenario: I commit, push to the remote server, and then commit something else with --amend. If I try to push again, I'll get an error because I changed history that was already pushed. Lets say I do
When I am trying to commit changes in my git project I keep getting the following message: E325: ATTENTION Found a swap file by the name .git/.COMMIT_EDITMSG.swp Tried all options available on that
I'm pretty new to this Git thing. I tried to commit my work, using commit amend inside GitX (cause I wanted to make only 1 final commit). I pulled the latest source, resolved conflicts, then staged an
Does have a commit int the git history same hash after geting into the same state? For example after revert? It is possible that there are more commits for one hash? Let us suppose history commit numb
I accidentally amended my previous commit. The commit should have been separate to keep history of the changes I made to a particular file. Is there a way to undo that last commit? If I do something l
I am trying to use JGIT to get the differences of a file from the last commit to the most recent uncommitted changes. How can I do this with JGIT ? (using the command line would be the output of git
Uh oh... I mistakenly committed a pretty complex change (including subdirectory and files renames) without really knowing what I am doing (or what Git would be doing). I now want to undo everything su
I can't do a lot of things with git and I want to remove a commit from my repo, because I uploaded wrong stuff. I used git revert <the_commit> but since the commit is root and I can't remove it.
I have a large repository git over 3 years, I want to delete history of changes that were more than a year ago. Is this possible? Can use git rebase but how?
I am new using Git. Yesterday I did a Clone, and after playing around (did lots of merging/branching) I decided to start brand new. So I deleted repositories, deleted all files including the main fold
git-notes is used to add or inspect object notes. How can I delete a git-notes commit, so the commit of git-notes command will not exist in git history. I want to delete git-notes commit, I'm not mean
I would like to amend a merge commit which failed a unit test on our continuous integration server, but I don't want to leave a commit which fails tests in the history. Since this commit was only used
I am currently working on a project which I periodically commit to the project Git repository on GitHub. Now I need to make major changes in this project without affecting the current release, so how
I want to write a module in python (This is the learning project) to enhance my git experience. Is there a python module for various git commands? At least the basic ones (commit/diff/log/add)? I saw
I want revert a directory in git - reverting all files inside, as well as removing any files added since that commit. Doing a checkout only seems to satisfy my first requirement, but doesn't delete an
Git refuses to strip out windows style line endings and commit with unix style line endings. Before anyone says to set my config files... I have run both of these commands and verified that they are p