Beginner question/problem. I used Git to commit a file to a repo on Github and used git show to confirm that it had been successful, but I'm unable to see the file on GitHub. Why is that? Are there any simple instructions for syncing up a file to GitHub that I could use to verify or indicate that it was pushed to GitHub?
问题:
回答1:
I used Git to commit a file to a repo on Github
You don't commit files directly to a repo on GitHub, you make commits in your local clone and then push those commits to remote repository, in this case GitHub.
... used git show to confirm that it had been successful
git show
does not tell you if the push has been successful or not, it just shows the contents of the last commit.
I'm unable to see the file on GitHub. Why is that?
Did you do a git push
?
simple instructions for syncing up a file to GitHub
You don't sync files with git, you work with commits. You use git push
to push local commits to a remote, and git pull
or git fetch
to get commits from a remote to your local repo.
verify or indicate that it was pushed to GitHub?
The output of git push
tells you if the push succeeded or not.
回答2:
Are u pushing directly to the master branch?
you can always do a git shortlog to see your commits for accuracy. Add a limit to the number of commits.
e.g. git shortlog -10 will give you the last 10 commits that have been pushed to the remote.
Or maybe your local branch's refs do not point to the remote branches refs? Try a git fetch and then a git push --set-upstream
This will set the remote branch to hold everything you push from your local branch.