Reputation: 56799
I am really new to git and I tried today to do my second ever commit of some new code to my repo. The thing is, I'm not sure if the git actually occurred.
Github says the last commit was 2 days ago.
When I type git add .
nothing shows up.
When I go to github, the Rails3 file says loading commit data
. I have been waiting for about 30 minutes but this is still there (and my commit wasn't all that big).
Is this typical behavior for git or could I have done something wrong? Also, how can I check to make sure in the future that the commits are happening when I try to do them?
Upvotes: 3
Views: 237
Reputation: 129782
If you are modifying files that are already tracked (ie. git status doesn't show any untracked files), I do this:
git commit -am "message"
git push
If you have new files or deleting files or directories then do this:
git add . -A
git commit -m "message"
git push
you can check to see if your commit worked with:
git log --stat
you can check to see if your commit got pushed to the remote server with:
git status
You should NOT see "Your branch is ahead of 'xxxxxx' by 1 commit" where xxxx will be something like origin/master.
Hope this helps.
Upvotes: 2
Reputation: 994887
First, although you're using Github, make sure you understand that you're interacting with your local repository first. (Github isn't involved until you push.)
The most important command to find out the status of your repository is git status
. This shows files that are:
git add
has been run)Once you make a commit, the files will disappear from the git status
display. At that point, you can use git log
to show the log of commits made in your repository (most recent first).
Upvotes: 6
Reputation: 10337
Typical work flow would be:
git add *
git commit -am "message"
git push
Upvotes: 0