赞
踩
git修改远程项目地址
git remote set-url origin [url]
有时会遇到git branch -a时总是不出现新的分支或者远程已经没有的分支在本地还有,这时就需要更新下本地的git分支保持和远程分支一致,使用下面命令即可:
git remote update origin --prune
或
git remote update origin -p
或
git fetch origin --prune
或
// p 小写
git fetch -p
回滚
git reset --hard {commit id}
git branch -d 分支名
使用git branch -D命令强制删除本地分支
这个命令会强制删除分支,无论是否有未合并的更改。
git branch -D branch_name
删除远程分支
如果要删除远程代码仓库,如gitlab中的代码分支,使用如下命令
该命令会删除远程代码库的分支,但不会删除本地分支
git push origin –delete 分支名
查看项目分支(包括本地和远程)
git branch -a
回退版本查看commit记录
git log
reset commit记录
git reset --hard 52602b0b04b57b33310fa256707518b126d2648c
撤销 commit记录
git reset --soft HEAD~1
查看用户名和邮箱地址
git config user.name
git config user.email
修改用户名和邮箱地址
git config --global user.name "username"
git config --global user.email "email"
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。