Git使用操作指南

Git使用操作指南

1.Git常用命令集锦

git init	#add a new git repository in current directory
git config user.name # set the username for current project
git config user.email # set the email for the current project
git config --global user.name # set the global username
git config --global user.email # set the global email
git status	# check the status 
git branch	# check all the branch of the local repository
git add file_name # add a new file into the temporary storage
git add .	# add all files into the temporary storage
git rm --cached file_name	# recall the file form the temporary storage
git commit file_name	# commit the content of temporary storage on the local respository
git commit -m “descriptions” file_name	# commit the content of temporary storage on the local respository with descriptions
git log	# check all commit log
git log --pretty=oneline	# check all commit log with information in oneline
git log --oneline	# check all commit log with part of information in oneline
git rm file_name # remove file
git diff	# check the content of updating
git branch -v	# check all branches of current projecct
git branch branch_name	# create a new branch in local repository
git checkout branch_name	# change into the new branch
git checkout master	# change back to the master 
git merge branch_name	# merge current branch into master
git push repository_name branch_name	# git push origin  master: push local pository to the branch of remote respository 
git clone remote_repository_address # clone project from remote respository address
git remote -v	# check the alias of the remote repository
git remote add alias # add a new alias for the remote repository
git merge --abort	# uncall the merge
git reflog	显示所有版本的提交历史(会有索引信息)
git reset --hard 索引值	根据索引值切换版本
git reset --hard HEAD^	指令中包含几个^符号则代表回退几个版本。
git reset --hard HEAD~2	~后的数字代表几个版本
git reset --soft 索引值	根据索引值切换版本(HEAD指针指向最新版本,但文件并没有恢复到最新版本)
git reset --mixed 索引值	根据索引值切换版本(mixed参数会改变版本区的指针并重置索引)

2.Git常用操作

2.1Git克隆新项目

## clone 远程仓库到本地
git clone https://github.com/naveenanimation20/PageObjectModel.git
## 指定分支dev 分支 clone项目
git clone -b dev https://github.com/naveenanimation20/PageObjectModel.git
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值