Git
2016-01-31
删除远程分支时报错:
git push --delete origin new
error: 无法删除 'new':远程引用不存在
error: 无法推送一些引用到 'gitee.com:markjour/django-admin'
如果是英文环境就是报:
git push --delete origin new
error: unable to delete 'new': remote ref does not exist
error: failed to push some refs to 'gitee.com:markjour/django-admin'
一般是这个分支已经被别人删除了。
Solution
git branch -d -r origin/new
Git CheatSheet
2013-12-03
Linus 为了托管内核代码的方便,创建了 Git。
之前,Linux 开发者使用的是 BitKeeper,不过社区对这个私有工具总是不放心,然后 BitKeeper 方面对于部分开发者试图逆向工程不满。
对于大多数公司来说, Git 的设计颇为复杂。
但是没办法,现在 Git 已经成为大多数开发者的选择。
基础命令
git config
配置
git init
初始化当前目录为 git 仓库
git clone
克隆一个远程仓库到本地
git add
添加变更(提交之前的挑选)
git commit
提交变更
git push
推送变更到远程仓库
git pull
拉取远程仓库变更,并合并到本地;等于 git fetch
+ git merge
git status
查看变更状态
git log
查看提交历史
git branch
分支管理
git checkout
切换分支
git fetch
拉取远程仓库变更
git merge
合并分支
示例
git config --global user.name "Your Name"
git config --global user.email "your@email.com"
git clone git@github.com:your-username/example
cd example
# 创建新文件
echo "hello" > newfile
git add newfile
git commit -m "Add newfile"
git push origin master
参考资料与拓展阅读