git gui & git bash 的简单操作手册 - 将本地更改上传更新到远程服务器

来源:互联网 发布:知豆充电家里能充吗 编辑:程序博客网 时间:2024/05/20 00:36

如何将本地更改上传到远程服务器:

通过git bash,如下命令将实现操作

A.执行更改操作之前必须确保执行-从远程同步最新内容到本地git分支的操作

1. git fetch origin master:master

2. git rebase master my_branch

3. git checkout my_branch

同步完成之后,进行更改操作,

B. 然后执行如下命令

  • git add -a|<path_to_changed_files>

-a: 指将所有更改都添加到暂存区

<path_to_changed_files>:将具体文件的更改添加到暂存区

  • git commit -m "comments for this commits" 将暂存区的更改提交到本地git my_branch中
  • git push origin My_branch:refs/for/master : 从本地branch更新到远程的master中
通过git gui, 操作图形化简单方便

在更改操作之前先教大家一个git gui的命令添加技巧,可以大大方便在git bash重复输入命令:)

1. 从git gui的工具栏中选择Tool -> add

2. 在add界面添加name 以及相关的命令如


3. 更改操作之前的更新操作可以通过以上动作添加的命令进行运行,以防止重复输入git bash 命令

4. 接下来可以对内容进行更改操作了。

5. 通过点击按钮 Rescan 即可将你做的更改显示在unstage 区域如图

6. 点击stage changed 按钮,那么所做的更改将会添加到暂存区相当于执行命令git add


7. 在点击commit按钮之前要添加Commit message 信息,并且注意选择是New commit. 相当于执行git commit -m "comments for this commits"



8. 接下来需要push命令更新到远程的服务器上git push origin My_branch:refs/for/master : 从本地branch更新到远程的master中

我经常使用将push的命令通过tool -add 添加使用,所以针对这里的push button使用没有做过,因此不做介绍,有兴趣的自己研究。

1 0
原创粉丝点击