温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Git相关使用命令有哪些

发布时间:2021-01-26 11:56:02 来源:亿速云 阅读:175 作者:小新 栏目:软件技术

小编给大家分享一下Git相关使用命令有哪些,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!

Git相关使用命令有哪些

全局设置

git config --global user.name "zyl"
git config --global user.email xxx@xxx.com
git config --list 检查你的git设置
git clone xxxxxx.git

添加新的文件

vim demo.txt
git add demo.txt 添加新的文件
git commit -m 'this is first commit' 提交到本地仓库,并且设置注释
git push 将推送这一转变为主分支
git rm xxx.txt 删除文件
git commit -m 'xxxx'; 提交到仓库
git push
git pull 拉取文件
git log -all 日志
git branch 查看所有分支
git log --stat xxx 查看 某个支点的提交信息
find .git/objects -type f 查看所有分支

阿里云相关命令:

命令行指令

Git 全局设置

git config --global user.name "z1577121881"
git config --global user.email "1577121881@qq.com"

创建新版本库

git clone git@code.aliyun.com:z1577121881/tantou.git
cd tantou
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master

已存在的文件夹或 Git 仓库

cd existing_folder
git init
git remote add origin git@code.aliyun.com:z1577121881/tantou.git
git add .
git commit -am "你需要填写的一些信息"
git push -u origin master

码云相关命令

设置全局信息

git config --global user.name "你的名字"
git config --global user.email "你的Email"
clone 和push
git clone http://xxxx/xxxx.git

创建特征分支

git checkout -b $feature_name

提交代码

git commit -am "this is commit "

推送到指定分支

git push origin $feature_name

为了方便,最好添加公钥到git.

可以通过下面命令生成

ssh-keygen -t rsa -C "xxxxx@xxxxx.com"# Creates a new ssh key using the provided email
# Generating public/private rsa key pair...

查看public key

cat ~/.ssh/id_rsa.pub
# ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6eNtGpNGwstc....

添加后,在终端(Terminal)中输入

ssh -T git@git.oschina.net

若返回Welcome to Git@OSC, yourname!

看完了这篇文章,相信你对“Git相关使用命令有哪些”有了一定的了解,如果想了解更多相关知识,欢迎关注亿速云行业资讯频道,感谢各位的阅读!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

git
AI