syncing local file to github repo

2019-09-11 07:33发布

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?

2条回答
够拽才男人
2楼-- · 2019-09-11 07:49

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.

查看更多
3楼-- · 2019-09-11 08:01

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.

查看更多
登录 后发表回答