git使用心得

来源:互联网 发布:centos分辨率设置 编辑:程序博客网 时间:2024/06/10 00:49

总结下最常使用的git命令,废话少说,直接上干货。

1)git初始化

这个新手一般很少遇见,但是如果要使用类似github这样的git仓库,第一个肯定是如何创建git的问题。

在github上先创建自己的仓库源,然后做以下操作1> git账户的录入   git config --global user.name "Your Name"   git config --global user.email you@example.com   全局的通过vim ~/.gitconfig来查看   git config user.name "Your Name"   git config user.email you@example.com   局部的通过当前路径下的 .git/config文件来查看   也可以修改提交的用户名和Email:   git commit --amend --author='Your Name <you@example.com>'2> git init (初始化本地git)3> git remote add origin git@github.com:*/*.git4> git add -A5> git commit -a -m 'blablabla'6> git push -u origin master -f

2)查看git已设配置

git config --list


3)git clone项目

git clone <span style="font-family: Arial, Helvetica, sans-serif;">git@github.com:*/*.git</span>

4)git推送代码

1> git add xxx(git add -A是准备add所有代码)2> git commit -a -m 'xxx' 3> git push(如果失败需查看是否有冲突)

5)git分支

git branch


6)忽略本地代码

git stash




0 0