1

I have committed and pushed my changes to github.com but when I delete the local directory and clone the repo to my local machine, I get a set of files that reflect the addition of new files in the last commit and the absense of files deleted in the last commit. What I do not get is files modified in the last commit, that is, I receive the files but they are old versions.

What other steps do I need to do?

Following this, I committed a minor edit to the readme file and I noticed that there is a message that "your branch is ahead of 'origin/master' by 1 commit'. What does this mean and how do I fix it?

user@pcLinux:~/backup9$ git commit
On branch master
Your branch is up-to-date with 'origin/master'.

Changes not staged for commit:
    modified:   README.md

no changes added to commit
user@pcLinux:~/backup9$ git add README.md
user@pcLinux:~/backup9$ git commit
[master b4c856a] Improve the formatting of README.md.
 1 file changed, 22 insertions(+), 5 deletions(-)
user@pcLinux:~/backup9$ git push https://github.com/H2ONaCl/backup9.git master
Username for 'https://github.com': H2ONaCl
Password for 'https://H2ONaCl@github.com': 
Counting objects: 5, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 509 bytes | 0 bytes/s, done.
Total 3 (delta 2), reused 0 (delta 0)
To https://github.com/H2ONaCl/backup9.git
   f082024..b4c856a  master -> master
user@pcLinux:~/backup9$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)

nothing to commit, working directory clean

Edit: I deleted the directory and cloned again. It seems that README.md modifications are being received from github but modifications to other files are not, that is, the other files are still old versions.

H2ONaCl
  • 10,644
  • 14
  • 70
  • 114

1 Answers1

1

In your sequence, you only add and commit README.md, so a new clone will reflect that modification.

If you want to be sure to include all your modifications/additions/deletions:

git add -A .
git commit -m "new commit"
git push
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Yes, but in a previous sequence not shown, I added files, deleted files, and modified files. The adds and deletes are available in a re-cloning but not the modifications. – H2ONaCl Oct 06 '15 at 04:52
  • @H2ONaCl Sure: try a `git add -A .` next time, and see if it works better. Check also those files aren't ignored with `git check-ignore -v -- myfile`. – VonC Oct 06 '15 at 04:53
  • May be I was thinking of mercurial `add` which is used "early on" for unknown files where as git add is clearly different. – H2ONaCl Oct 06 '15 at 05:08
  • @H2ONaCl regarding the *git* 'add' one, you can see more at http://stackoverflow.com/a/3003322/6309 and http://stackoverflow.com/a/16162511/6309 and http://stackoverflow.com/a/24950133/6309 – VonC Oct 06 '15 at 05:11
  • @H2ONaCl Btw, you can do the same using: `git commit -m 'your message' . && git push` :-) – Ionică Bizău Oct 06 '15 at 06:09