reza
reza

Reputation: 6358

git commit to remote repository not working

Not understanding why my commit to remote git repo is not working.

So I clone a branch from the remote repo

git clone -b MYBRANCH [email protected]:/home/my.git

I modify a file called test

git diff shows the change

diff --git a/test b/test
index e69de29..9ccc327 100644
--- a/test
+++ b/test
@@ -0,0 +1,3 @@
+changed.
+
+

when I go to commit, no changes are added to the commit.

git commit -m "changed the test file"
# On branch MCKINLEY
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#   modified:   test
#
no changes added to commit (use "git add" and/or "git commit -a")

What am I missing here?

Upvotes: 1

Views: 1086

Answers (3)

John Gagliardi
John Gagliardi

Reputation: 78

I recommend trying a git status to see if the file needs to be added.

git status

If you still need to add files to the commit then either do git add . or git add

git add .

Then your commit should be ready to go

git commit -a

Hope that helps!

Upvotes: 1

Roy Truelove
Roy Truelove

Reputation: 22456

you need to add it to the index.

git add test

Guessing you might be new to git.. check out here for a good intro to what the index is.

Upvotes: 3

manojlds
manojlds

Reputation: 301167

Isn't the message telling you what to do?

Do git add test

Note that git add is not only to add a new file, but also to add / stage modifications to an existing file

Upvotes: 2

Related Questions