1. Create a new repository:
echo "# Backupvim" >> readme.mdgit initgit add readme.mdgit commit-m "First commit"https://git Hub.com/fankcoder/xxx.gitgit push-u Origin Master
2. Update the project (new file added):
$CD ~/pywork
$git Add. #这样可以自动判断新加了哪些文件, or manually add the file name
$git Commit #提交到本地仓库
$git Push Origin Master #不是新创建的, no more add to remote
3. Update the project (no new files, only delete or modify the file):
$CD ~/hello-world
$git commit-a #记录删除或修改了哪些文件
$git Push Origin Master #提交到github
4. Ignore some files, such as *.O, etc.:
$CD ~/hello-world
$vim. Gitignore #把文件类型加入到. Gitignore, save
Then you can git Add. can automatically filter this file
5.clone code to Local:
$git Clone [Email protected]:wadeleng/hello-world.git
If the code exists locally, and the repository has updates, merge the changes into the local project:
$git Fetch Origin #获取远程更新
$git Merge Origin/master #把更新的内容合并到本地分支
6. Revocation
$git Reset
7. Delete
$git RM * # is not in RM
#------------------------------Common Errors-----------------------------------
1.$ git remote add origin [email protected]:wadeleng/hello-world.git
error Hint: fatal: The remote already exists origin.
WORKAROUND: $ git Remote RM origin
Then in execution: $ git Remote add origin
Https://github.com/fankcoder/xxx.git
#就不会报错误了
2. $ Git push origin master
error message: Error:push failed
Workaround: Git pull Origin master #先把远程服务器github上面的文件拉先来, then push up.
My github code is added