Reputation: 36879
I'm a total newcomer to GIT and repositories, so I ran into a problem and dont know what I did wrong
I'm not sure if I'm doing something wrong but I did the following
git pull
in my local repo to ensure I have all the latest commitsgit status
on local it showed me that two files have been modified. So then I tried git push
to push my changes up, and this showed my all where already up to dategit push
actually did something,git status,
it showed me 2 files where modified, I then went to git log
which showed my commits on local, I then re-commited the files server side and my changes just did not take effect. git reset --hard HEAD
but still my changes did not show,What am I doing wrong?
Upvotes: 1
Views: 188
Reputation: 285027
It sounds like you're pushing to a repository with a working tree attached. To avoid problems, it's better to push to only bare repositories, those created with git clone --bare
(or equivalent).
If you do push to non-bare repos, anyway, you will have to do the following commands on the server. This will lose all local (non-committed) changes.
git reset --hard HEAD
git checkout -f
Upvotes: 1
Reputation: 33223
You have to add your changes to the index and then commit them.
git add modified_file
git add other_file
git commit -m "message"
The use of the index to construct the next commit makes it possible to do things like add only some of the changes in a modified file (see git-gui's Stage hunk menu option). Once the index has the correct set of modifications then git commit
forms a commit out of that. git push
is used to send commits that your repository contains that are not present in the upstream repository. So if there are no new commits on your local side, nothing will be done.
Upvotes: 0