You have not "added" your files to the repository, only to the staging index.
You need to git commit
to get your changes from the staging index
to the repository
.
git status
shows you the status of the working tree and staging index. git log
shows you the status of the history - in other words, git log
will show you what's been committed to the repository.
As an example, see this git status
output:
git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD ..." to unstage)
#
# modified: Game.py
#
In this case, we can see that the changes to be committed involve Game.py
. Note that these changes haven't yet been added to the repository - they're just staged, ready to be committed, as the git status
says.
The next step is to commit these changes we've prepared in the staging index
and add them to the repository. git commit
is the command to do this.
This answer, as well as the linked Pro Git book, have some excellent reading which will help you understand the setup and steps in committing to a git
repository.
I cannot see them in my actual repository.
What do you mean by "actual" repository? I am presuming you mean you can't see a local commit, but there may be some confusion about the repositories you're using.
You're using two repositories, one local
and one remote
. The remote
repository is, in your case, on GitHub. You do your work locally, then git push
to remote.
First, local changes and commits
So the steps to get your code changes into the local
repository are as follows:
- Make changes in your
working directory
. This is most often writing some code.
- Build a
commit
by staging changes. This is done using git add
.
- "Save" the commit you've built into the repository. This is done using
git commit
.
These steps take place **locally*. None of these steps have any affect on your GitHub
repository.
Secondly, git push
to the remote
repository (in this case, your GitHub one).
To get your code from local
to remote
repositories, git push
is used.
- Check what
remote
repositories are known by your local
repository: git remote -v
.
- If the
GitHub
repository is not shown, you'll need to add it: git remote add <NAME> <URL>
.
- Because you didn't
git clone
, the two repositories (local
and remote
) don't have any commits in common. That's ok; it just means git
doesn't automatically know where to push your changes, so you'll have to specifiy: git push <NAME> master:master
. That'll push your local master
branch to the <NAME> master
branch.