You can add files for being tracked by git using git add, example git add README, git add /*, or even git add *
Then use git commit -m "some_msg" to commit files, which will save the content of your file in the local system
Finally git push -u origin master to push files to the remote master branch.
When you make modifications run git status which gives you the list of files modified, add them using git add * for everything or you can specify each file individually, then git commit -m <message> and finally, git push -u origin master
Example - say you created a file README, running git status gives you the status like on which branch you are currently in, the files' names which are not yet added etc.
$ git status
# On branch master
# Untracked files:
# (use "git add ..." to include in what will be committed)
#
# README
Run git add README, the files are staged for committing. Then run git status again, it should give you - the files have been added, staged and are ready for being committed.
$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD ..." to unstage)
#
# new file: README
#
nothing added to commit however trackless files present (use "git add" to track)
Then run git commit -m 'Added README'
$ git commit -m 'Added README'
[master 6402a2e] Added README
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 README
Finally, git push -u origin master to push the remote branch master for the repository origin.
$ git push -u origin master
Counting objects: 4, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 267 bytes, done.
Total 3 (delta 1), reused 0 (delta 0)
To [email protected]:xxx/xxx.git
292c57a..6402a2e master -> master
Branch master set up to trace the remote branch master from origin.
The files are pushed with success to the remote repository.
Running a git pull origin master to ensure you have absorbed any upstream changes
$ git pull origin master
remote: Counting objects: 12, done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 8 (delta 4), reused 7 (delta 3)
Unpacking objects: 100% (8/8), done.
From xxx.com:xxx/xxx
* branch master -> FETCH_HEAD
Updating e0ef362..6402a2e
Fast-forward
public/javascript/xxx.js | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
create mode 100644 README
If you do not need to merge the upstream changes along with your native repository, run git fetch to fetch the changes and then git merge to merge the changes. git pull is simply a mix of fetch and merge.