text 混帐
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text 混帐相关的知识,希望对你有一定的参考价值。
//Git global setup
git config --global user.name "静航"
git config --global user.email "luoli.zll@alipay.com"
//Create a new repository
git clone git@gitlab.alipay-inc.com:luoli.zll/artvcsdk_andorid_demo.git
cd artvcsdk_andorid_demo
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master
//Existing folder or Git repository
cd existing_folder
git init
git remote add origin git@gitlab.alipay-inc.com:luoli.zll/artvcsdk_andorid_demo.git
git add .
git commit
git push -u origin master
//从某台服务器克隆一个git库,并且切换到某个远程分支
$ git clone git@gitlab.alipay-inc.com:business_release/artvcroom.git
Cloning into 'artvcroom'...
remote: Counting objects: 653, done.
remote: Compressing objects: 100% (401/401), done.
remote: Total 653 (delta 129), reused 552 (delta 91)
Receiving objects: 100% (653/653), 3.18 MiB | 2.70 MiB/s, done.
Resolving deltas: 100% (129/129), done.
Checking connectivity... done.
$ cat .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = git@gitlab.alipay-inc.com:business_release/artvcroom.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
$ git branch
* master
$ git branch -r
origin/ANT01402615_normal_20160923_artvcroom
origin/HEAD -> origin/master
origin/master
//在远程分支的基础上新建一个本地分支dev
$ git checkout -b dev origin/ANT01402615_normal_20160923_artvcroom
Branch dev set up to track remote branch ANT01402615_normal_20160923_artvcroom from origin.
Switched to a new branch 'dev'
//在本地分支(一般是master)的基础上新建一个本地分支dev
$ git checkout -b dev
//一周后,来了一个问题,需要回到master分支解决这个问题
$ git checkout master
$ git checkout -b hotfix
//修改这个问题测试通过,可以考虑合并到master,然后干掉这个分支
$ git branch master
$ git merge hotfix
$ git branch -d hotfix
//这个世界清净了,继续去我的码农生活,回到dev吧
$ git checkout dev
//查看哪些分支已经合并了,哪些没有合并,对于已经合并的分支,可以直接删除
$ git branch --merged
$ git branch --no-merged
#git的三个配置文件,优先级从高到低
git config -e
git config -e --global
git config -e --system
#查看提交历史
$ git log --pretty=oneline
aff907f8f3109b9dd1641bcf3dd27f85392f51d2 add motion switch channel
814a25bb93d22e34dc96a50fdfd9b123f9ced8cb fixed screen
#精简格式查看当前工作区的文件状态
$ git status -s
M xxx.cpp
$ pwd
/Users/zhoull/refcode/ppp/src/csv2
$ git rev-parse --git-dir
/Users/zhoull/refcode/ppp/.git
$ git rev-parse --show-toplevel
/Users/zhoull/refcode/ppp
$ git rev-parse --show-prefix
src/csv2/
git help -w add
html的方式显示git add命令的用法
git rev-parse 3b18e512d
3b18e512dba79e4c8300dd08aeb37f8e728b8dad
git cache-file -p 3b18e512dba79e4c8300dd08aeb37f8e728b8dad
hello world
git ls-files -s
100644 89e2ec4d7ad113badc82ad08c2ac15ebefb8eb5a 0 include/ns_time.h
git remote add url
将本地的git库链接到github上的库url
git push -u origin master
-u 告诉 Git 去跟踪推送的分支,将它推送到 origin 远程版本库,同时将它推送到 master 分支
//获取到远程分支的更新到本地,它会自动创建对应的本地分支(new branch)
//3036acc..9eb5e40 表示远程分支从3036acc更新到了9eb5e40
git fetch origin
3036acc..9eb5e40 debian-release-20081030 -> origin/debian-release-20081030
* [new branch] debian-release-20081112 -> origin/debian-release-20081112
* [new branch] debian-release-20081112.1 -> origin/debian-release-20081112.1
3d619e7..6260626 master -> origin/master
//查看哪些地方更新了
git diff master origin/master
//查看完毕,把这些更新合并到本地分支
git checkout master
git merge origin/master
//错误修复:还没做add操作
git reset --hard HEAD or git checkout -- xxx.cpp or git checkout -- HEAD
//错误修复:已经add,但是还没有push
git revert HEAD
$ git tag -a v0.1.2 -m “0.1.2版本” #创建附注标签
$ git tag -d v0.1.2 #删除标签
$ git show v0.1.2 #查看标签的版本信息
$ git push origin v0.1.2 #将v0.1.2标签提交到git服务器
$ git push origin –-tags #将本地所有标签一次性提交到git服务器
$ git tag #查看当前分支下的标签
阿里域密码更新后,git的处理:
1. git config --list 看看之前的密码
2. git config --user.password "xxxxx" ---- 更新密码
3. linux 平台的wifi密码设置修改成新密码
公钥登陆:
ssh-keygen -t rsa -C “haiyan.xu.vip@gmail.com”
查看git sha revision:
git ls-remote $repo-url HEAD | cut -f1
git ls-remote $repo-url --heads branch-heads/66 |head --lines 1 | cut -f1
git sha revision 和 git revision number 对应关系:
openssl base64 -d -A <<< $(curl --silent $repo_url/+/$revision?format=TEXT) \
| tail -1 | egrep -o '{#([0-9]+)}' | tr -d '{}#'
例子: 27654 就是对应的revision number
commit a3aa9bd75b094893160de8957592d7937a3b50da
Cr-Commit-Position: refs/heads/master@{#27654}
git crrev-parse refs/heads/master@{#24277}
948b7e37557af68b3bc9b81b29ae2daffb2784ad
git导出干净的代码
git archive --format zip --output "./output.zip" master -0
以上是关于text 混帐的主要内容,如果未能解决你的问题,请参考以下文章