这两天由于在下载一个linux系统下的c#内核支持插件,git 命令下载,死活就下不下来
git clone --recursive
git clone --recursive https://github.com/zabirauf/icsharp.git
git clone git_repo_address 获取代码到本地
git config --list 检查已有的配置信息
git status 查看本地workspace
git add filename 添加文件到暂存区
commit filename -m"commit message"
git branch 查看本地分支
git branch -r 查看远程分支
git checkout branchname 创建本地分支
git checkout -b branchname 创建并切换至本地分支
git checkout -b branchname origin/remote_branchname 创建本地分支并与远程分支关联
git push origin local_branchname:remote_branchname 推送本地分支代码至远端分支
git branch -d branchname 删除本地分支
git tag -a tagname commitid -m"create message" 打tag
git log 日志相关
git log --pretty=oneline (每个提交在一行显示)
git log --pretty=short (log显示commit id 修改者,备注)
git log --pretty=format:"%H - %an" (自定义日志输出格式)
还原相关
git reset commit_id(git reset filename)
git add .
git reset --hard 回退到上次提交版本
git reset --mixed 放弃本次提交(未提交状态)