Git入门
获取某分支下某tag下的代码
git checkout -b branch_name tag_name
查看存在的tag
git tag -l
切换到某个tag
git checkout tag_name
更新本地develop分支
git pull origin develop
测试提交代码:
git add 目录
对比本地develop分支与远程develop分支差异
git checkout -b develop origin/develop
提交到本地代码库
git commit -a -m "add import export test case"
提交到远程develop分支
git push origin develop
拉下远程所有分支
git fetch
查看远程有所分支名,并查看自己在哪个分支上
git branch -a
Git分布式版本控制:
Git clone
进入项目
cat .git/
查看远程分支名
cat .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = ssh://[email protected]/~/pim/db
[branch "master"]
remote = origin
merge = refs/heads/master
查看当前自己在什么分支上
git branch -a
将远端develop checkout到本地develop分支
git checkout origin/develop -b develop
git branch -a
修改。。。。
查看状态
git status
从本地分支上remove test文件夹
git rm -rf test/
commit自己的修改
git commit -m "remove pom comment"
git status
# On branch develop
# Your branch is ahead of 'origin/develop' by 1 commit.
#
push这origin远程分支到主版本库
git push origin
如果非最新版代码执行pull
git pull
查看到自己的修改与其他人没有冲突
remote: Counting objects: 19, done.
remote: Compressing objects: 100% (7/7), done.
Unpacking objects: 100% (10/10), done.
remote: Total 10 (delta 2), reused 0 (delta 0)
From ssh://git.dianxin.us/~/pim/db
abecc1a..a2eb552 develop -> origin/develop
Merge made by recursive.
.../dianxinos/pim/database/PimAccountECard.java | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
gitg & 查看git分支
git rebase a2eb5521d此号为shard号