git心得

时间:2021-12-14 03:54:51

使用Git得到了以下体会:

github在新的目录下添加新的文件

git init //在相应的目录下添加 git add //添加目录 git commit -m "first commit" git config --global user.email "834916321@qq.com" git config --global user.name "timeless" git remote add originhttps://github.com/timelessz/crm.git gitpush -u originmaster

遇见错误

1.$ git remote add origingit@github.com:WadeLeng/hello-world.git

错误提示:fatal: remoteorigin already exists.

解决办法:git remote rmorigin

然后在执行:$ git remote add origingit@github.com:WadeLeng/hello-world.git就不会报错误了

2 已经有的文件更新

先把gihub上的文件更新下来:git pull origin master

错误提示:error:failed topush som refs to

解决办法:$ git pull origin master//先把远程服务器github上面的文件拉先来,再push上去。

3  复制文件到当前项目git clonehttps://github.com/timelessz/cardmanage.git

4本地已经存在了代码,而仓库里有更新,把更改的合并到本地的项目

git fetch origin //获取远程更新 git mergeorigin/master -m “ ”//把更新的内容合并到本地分支

5把服务器上的数据更新下来 gitpull origin master

推送项目的github的大致步骤如下: 1、在本地创建一个项目仓库,可以放些基本的项目文件 2、cd至该目录下 3、git init 执行git初始化,完成对该项目的版本监控 4、git add 将该库中的内容加到暂存区 5、git commit 完成项目快照(与svn的提交有所区别) 6、git remote add 随便一个单词 git@github.com:HuXiangtao/项目名称.git(完成于github的通信,前面几个步骤基本是在本地操作的。) 7、git push 随便一个单词 master(分支名字)
--------当需要修改项目内容的时候---------------- 1、git clone GitRead-Only (将最新版克隆到指定的路径中) 2、修改 3、git add . 4、git commit -m"修改描述"(必须要加) 5、git remote add (通信) 6、git push .... master

https://github.com/sunjing2013/Test/tree/master

结队人     姜岩