justnajm
justnajm

Reputation: 4534

How to add untracked file in last git commit?

I initiated git, then used following command to add all the files in commit.

git add *
git commit -m "Starting project modifications"

but still there is .htaccess file as untracked, I don't know why it was not added now I want to add it to my last commit. How can I add it without doing another commit.

Upvotes: 1

Views: 167

Answers (1)

Awais
Awais

Reputation: 91

As mentioned here:

https://www.atlassian.com/git/tutorials/rewriting-history/git-commit--amend

Following is the example:

# Edit hello.py and main.py
git add hello.py
git commit

# Realize you forgot to add the changes from main.py
git add main.py
git commit --amend --no-edit

Upvotes: 1

Related Questions