GIt如何进行代码管理

一:Git账号设置(仅第一次需设置):

       1.首先打开GIt  Bash  界面

       2. 输入指令邮箱号: git config --global user.email "邮箱"

       3.输入指令GIt用户名 : git config --global user.name 用户名

       4.输入指令ssh: ssh-keygen -t rsa -C 邮箱

      

二:Git如何上传代码。

       1.先找到指定脚本目录。指令: cd  e:/GIt/ehr-authomation

       2.添加上传文件。 指令: git add -A

     3: 查看修改文件。  指令: git status

       4:提交修改的文件。 指令: “git commit -m ""message(描述)”

       5: 上传仓储文件到服务器。指令: git push

     

6.查看 上传文件是否成功。指令:git pull –rebase。 检查本地代码是否与服务器一致。

小结: git常用指令。

    1.    Add文件
git add <file>    (one file)
git add -A (all)
git add . (new, modified, without deleted)
git add -u (modified, deleted, without new)

2.    Commit到暂存区
git commit -m ""
git commit –s (# -s option is mandatory, git will add "Signed-off-by: YOUR NAME <YOUR EMAIL ADDRESS>" at the end of message.)

3.    从remote取最新的代码到本地
git pull –rebase

4.    存在冲突,解决完冲突
git add xxx
git rebase --continue (or git rebase --skip)

5.    提交
git push origin HEAD:refs/for/master
git push

创建分支

1. 切换到基础分支,如主干
git checkout master


2. 创建并切换到新分支
git checkout -b  feature_XX


git branch可以看到已经在feature_XX分支上


3.更新分支代码并提交
git add *


git commit -m "create branch feature_XX"


git push origin  feature_XX

原文地址:https://www.cnblogs.com/Shanghai-vame/p/7683470.html