Git命令行项目提交服务器步骤

Git base operate

1. 创建目录文件夹并进入 pwd可查看现在所在的位置
mkdir folder

2. git创建
git init

3. 说明文档创建
touch README.md

4. 将改动添加到暂存区
git add.

5. 添加提交说明
git commit -m ‘版本1’

6. 将本地更改推送到远程分支
git push -u origin master


Git branch

git branch -r 查看远端分支

git branch -a 查看本地及远端分支

git checkout -b master 切换并创建分支

git branch 查看本地分支


Git global setup

git config --global user.name "zhouen"

git config --global user.email "xxxx@163.com"


Create a new repository

git clone http://192.168.1.134/zhouen/test.git

cd test

touch README.md

git add README.md

git commit -m "add README"

git push -u origin master

git pull origin master

git clone -b master http://192.168.1.134/zhouen/test.git  克隆某个分支到本地


Existing folder

cd existing_folder

git init

git remote add origin http://192.168.1.134/zhouen/test.git

git commit -m "Initial commit"

git push -u origin master

git add .   添加变化的内容包括新文件但不包括被删除的文件 到暂存区域

git add —all   添加变化的内容包括新文件同时包括删除的文件 到暂存区域

git remote -v

git remote remove remote_name

git remote set-url remote-name new_url


Existing Git repository

cd existing_repo

git remote add origin http://192.168.1.134/zhouen/test.git

git push -u origin --all

git push -u origin --tags

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Lesson 3: Using GitHub to Collaborate 3.1 Creating a GitH...
    赤乐君阅读 6,192评论 3 11
  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,499评论 0 10
  • 因为原文太长超出字数,Lesson 3 就放在另一篇文章里 How to Use Git and GitHub 标...
    赤乐君阅读 5,360评论 1 5
  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 135,273评论 19 139
  • 题目描述请实现一个函数,将一个字符串中的空格替换成“%20”。例如,当字符串为We Are Happy.则经过替换...
    六尺帐篷阅读 316评论 0 2