top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

GIT: How to add a file later to a commit?

+2 votes
435 views

How can I add a file later to a commit? I created a new branch and submitted a commit with 2 files.

I observed, that one more file should have been submitted with this commit, so I would like to add a file to an earlier commit.

Any solution for this?

posted May 22, 2015 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

If it's the latest commit you want to amend, then have a look att git commit --amend. If it's not the latest commit you can start with an interactive rebase (git rebase -i), mark the commit you want to change for 'edit', and then use git commit --amend.

answer May 22, 2015 by Sidharth
Similar Questions
0 votes

I want to retrieve the commit history of a given file.What command should I issue? I expect the command like below.

D:GitTest> git show --commit-history test.txt
8194aaa
c419234
...
0 votes

I want to show commit related information by the command below.By this, committed files are shown, but names only, off course.But in addition to this, I want to show commit file types (New, Edited, and Deleted).What argument should I use in the command?
git --no-pager show --format=%h%n%an%n%ai%n%s --name-only

+2 votes

Is it possible to add custom metadata to Git commit object?
Such metadata should be ignored by Git commands, but could be used by a 3-party tool which knows the format and knows where to look.

I assume that this should be possible, given that Git objects are actually patches, and patches can contain additional details. But can this be done with the help of Git commands?

+2 votes

Can someone help me on how to delete an intermediate commit?

...