黑马程序员技术交流社区

标题: git的常用命令 [打印本页]

作者: 马马耶夫岗    时间: 2016-4-19 22:15
标题: git的常用命令
1. 创建git资源库
        git init --bare 库名称
       
2. 在用户文件夹下把资源clone下来
        git clone <仓库目录> /g/software/repository/git/itheima <用户目录> .
        注意:clone时候用户目录必须为空

3. 创建一个文件,纳入到版本控制中。
        git add <文件名>
        第一次执行会出警告:warning: LF will be replaced by CRLF in readme.txt.
                                                The file will have its original line endings in your working directory.
        警告处理:需要配置用户信息
                                        git config user.name = "zhangsan"
                                        git config user.email = "itheima@gmail.com"
                                       
4. 提交到本地版本库里。
        git commit <文件名>
       
5. 推送到远程共享版本库中
        git push origin master
       
6. 切换用户,拉取最新的文件
        git pull




欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) 黑马程序员IT技术论坛 X3.2