git git extension操作

来源:互联网 发布:php接口代码 编辑:程序博客网 时间:2024/05/19 03:45

1.首先你要有个git账号   建立一个git库



2. 运用git  之前先认识一下.ssh  (ps:链接地址)

如果你原来创建过.ssh一般都在C:\Users\Administrator\.ssh 下面



.ssh文件里面可能包括以下几个文件

id_rsa.pub  为自己的公钥 (ps:有时候可能push不上去是因为少了config文件 如下为config内容)



如果你原来没有生成过git key 那么你可以生成一份  链接地址


3.之后如何push上去呢

push之前 你需要在github设置你的公钥  就是刚提到id_rsa.pub  里面的内容  可以用编译器打开把内容拷贝到Github .ssh设置里面  如下图我是已经配置好的




如果你是用命令行  已下操作便可以了

echo "# wqe" >> README.mdgit initgit add README.mdgit commit -m "first commit"git remote add origin git@github.com:wujianglong/wqe.gitgit push -u origin master



如果你是用git extensions   点击开始>打开把需要的文件打开  然后他会提示 点确认文件里面自动添加.git文件


push之前如果有问题看下  工具>设置 是否书如下配置  


如果有其他问题  可以百度下!  问题都不会很大 大到解决不了是不可能的  


对了  我觉的有必要补充几点 git merge 合并分支    Git adbase  衍合 是有区别的    衍合将以一个分支继续下  大家可以自行百度

git  revert   与 git reset  区别

一般git revert更加安全  他会以新的提交的方式  提交   如果你已经push了代码  又想还原前面的commit这个更好  如果你没有push的话 合理情况下用git reset 还原提交


git reset  又分三种模式  混合模式  硬性模式 软性模式

我知道提交过程是 这样的 工作目录副本(代码编辑过)  git add.  添加到缓存区   git commit 本地库  git push 远程库


这三种模式  改变的是  工作目录副本 与缓存区   下图最直观了  也可下看这个哥们写的(链接)




Definitions

首先,让我们来解释几个定义.

First, let’s define a few terms.


HEAD(头)

指向当前branch最顶端的一个commit,该分支上一次commit后的节点

This is an alias for the tip of the current branch, which is the most recent commit you have made to that branch.


Index(索引)

The index, 也可以被认为是staging area(暂存区), 是一堆将在下一次commit中提交的文件提交之后它就是 HEAD的父节点. (译注:git add添加的文件)

The index, also known as the staging area, is the set of files that will become the next commit. It is also the commit that will become HEAD’s parent.


Working Copy(工作副本)

当前工作目录下的文件,(译注:一般指,有修改,没有git add,没有git commit的文件)

This is the term for the current set of files you’re working on in your file system.