You can add files using git add
, example git add README
, git add <folder>/*
, or even git add *
(您可以使用git add
添加文件,例如git add README
, git add <folder>/*
,甚至git add *
)
Then use git commit -m "<Message>"
to commit files
(然后使用git commit -m "<Message>"
提交文件)
Finally git push -u origin master
to push files.
(最后git push -u origin master
来推送文件。)
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
(当您进行修改时,运行git status
,它会为您提供修改的文件列表,使用git add *
为所有内容添加它们,或者您可以单独指定每个文件,然后git commit -m <message>
最后, git push -u origin master
)
Example - say you created a file README, running git status
gives you
(示例 - 假设您创建了一个README文件,运行git status
会给您)
$ git status
# On branch master
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# README
Run git add README
, the files are staged for committing.
(运行git add README
,将文件暂存以进行提交。)
Then run git status
again, it should give you - the files have been added and ready for committing. (然后再次运行git status
,它应该给你 - 文件已经添加并准备好提交。)
$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: README
#
nothing added to commit but untracked files present (use "git add" to track)
Then run git commit -m 'Added README'
(然后运行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
推送存储库origin
的远程分支master
服务器。)
$ 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 xxx@xxx.com:xxx/xxx.git
292c57a..6402a2e master -> master
Branch master set up to track remote branch master from origin.
The files have been pushed successfully to the remote repository.
(文件已成功推送到远程存储库。)
Running a git pull origin master
to ensure you have absorbed any upstream changes
(运行git pull origin master
以确保您已吸收任何上游更改)
$ 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 want to merge the upstream changes with your local repository, run git fetch
to fetch the changes and then git merge
to merge the changes.
(如果您不想将上游更改与本地存储库合并,请运行git fetch
以获取更改,然后使用git merge
来合并更改。)
git pull
is just a combination of fetch
and merge
. (git pull
只是fetch
和merge
的组合。)
I have personally used gitimmersion - http://gitimmersion.com/ to get upto curve on git, its a step-by-step guide, if you need some documentation and help
(我亲自使用gitimmersion - http://gitimmersion.com/来获取git上的曲线,这是一个循序渐进的指南,如果你需要一些文档和帮助)