`

MAVEN

 
阅读更多
#git
---
# github repositories
##data
git@github.com:JasonLiu798/KnowledgeBase.git
git@github.com:JasonLiu798/JasonLiu798.github.io.git

##project
git@github.com:JasonLiu798/leetcode.git
git@github.com:JasonLiu798/bashlib.git
git@github.com:JasonLiu798/hbasecomponent.git
git@github.com:JasonLiu798/jsonblog.git
git@github.com:JasonLiu798/BlogSearchWithLucene.git
git@github.com:JasonLiu798/lucenestudy.git
##backup
git@github.com:JasonLiu798/backup.git
##gitcafe
git@gitcafe.com:async/uweatwhat.git


---
#git study
[廖雪峰git](http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000)
[git sheet](http://www.git-tower.com/blog/assets/2013-05-22-git-cheat-sheet/cheat-sheet-large01.png)
![开发一般模式图](http://pic.browser.360.cn/t019342927afbbecc13.png)
[Git Community Book 中文版](http://gitbook.liuhui998.com/index.html)
[pro git](https://www.gitbook.com/book/gitbookio/progit)

---
#common command
##init
    git init

##delete one 删除
    git rm -r --cached {filename}
    git rm -r -n --cached  */src/\*      //-n 展示要删除的文件列表预览

##add one
    git add {filename}
    git add .

##commit
    git commit -m {"comments"}

##chk status
    git status

##chk different
    git diff
    git diff HEAD -- {filename}
    git diff {version1} {version2}
    git diff {version1}:{filename} {version2}:{filename}
    
    git diff b030b905e5ccd7f85a89da:src/cn/com/cnpc/backGroundServer/component/AH809Component/TransportHandler.java 48a3cf0e615af714d0df7:src/cn/com/cnpc/backGroundServer/component/AH809Component/TransportHandler.java

##git log
    git log
    git log –pretty=oneline
   
    git reflog
    git rm -r --cached filename
    git show [version id]

##rebase
[git rebase 基础](http://blog.csdn.net/hudashi/article/details/7664631)
[git rebase 讨论 segmentfault](http://segmentfault.com/q/1010000000430041)
在不用-f的前提下,想维持树的整洁,方法就是:在git push之前,先git fetch,再git rebase。
git fetch origin master
git rebase origin/master
解决冲突,最后 git add * ,但不许要git commit 
解决后,执行 git rebase --continue
git push


##reset
[git reset简介](http://blog.csdn.net/hudashi/article/details/7664464)

     git reset –-hard commit_id      #强制撤销
     git reset HEAD file                    #commited,then upper
     git reset a4e215a7[version] filename   #back to old version

    #冲突解决,强制覆盖本地文件
    git fetch --all  
    git reset --hard origin/master


##checkout
    git checkout -- filename        #not commit
    恢复某个已修改的文件(撤销未提交的修改):
    $ git checkout file-name
    还原已提交的修改(已经提交过的修改,可以反悔~)
    git checkout -f

##revert
    还原最近一次提交的修改:
    $ git revert HEAD
    还原指定版本的修改:
    $ git revert commit-id

##git remote
    git remote add [origin] [git@server-name:path/repo-name.git]
    git remote add [origin] [git@10.185.235.70:/home/git/project/sdtrans/sdtrans.git]
    git remote show [remoteRespName]
###rename
    git remote rename {oldName} {newName}
    git remote rename origin s70
    git remote rename github gh
###change url
    git remote set-url [name] [newurl]
###clone one
    git clone git@10.185.235.70:/home/git/project/sdtrans/sdtrans.git


##push
    git push -u origin master   #first time
    git push origin master      #after first

##git tag 
    git tag 查看所有标签。
    git tag 用于新建一个标签,默认为HEAD,也可以指定一个commit id;
    git tag -a -m “blablabla…”可以指定标签信息;
    git tag -s -m “blablabla…”可以用PGP签名标签;
    命令git push origin 可以推送一个本地标签;
    命令git push origin –tags可以推送全部未推送过的本地标签;
    命令git tag -d 可以删除一个本地标签;
    命令git push origin :refs/tags/可以删除一个远程标签。

##git stash 
    git stash list
    git stash apply恢复,但是恢复后,stash内容并不删除,你需要用git stash drop来删除;
    git stash pop
    feature 分支分支还没有被合并,如果删除,将丢失掉修改,如果要强行删除,需要使用命令
    git branch -D feature-vulcan。
    查看远端库git remote -v
    git push origin master


---
#Branch
[远程分支](http://www.lxway.com/12944846.htm)
## new branch
    git branch [branch name]
    git checkout -b [branch name]
    等价于
        git branch [branch name]
        gir checkout [branch name]
    
## git branch 查看分支
```bash
git branch
git branch -av      #查看远程分支
git br -vv #查看本地分支跟踪的远程分支
```
##切换分支
    git checkout [branch name]
## git checkout 签出分支
    git checkout <name>
    git checkout -b <name>      #change & new
    git checkout -b [分支名] [远程名]/[分支名]
    git co -b 
    签出远程分支
    git checkout --track origin/serverfix

## git branch 删除
```bash
git branch -d <name>

#删除 本地存在  and 远端不存在 分支
git remote show origin #查看
git fetch -p #删除
#删除远程分支
git push origin --delete <branchName>
```

## git branch 重命名本地分支
    git branch -m {oldName} {newName}
## 重命名远程分支
    git push --delete origin {oldName}      //删除远程分支
    git branch -m {oldName} {newName}
    git push origin {newName}
## 设置远端分支
    git branch --set-upstream-to=xxx
    git branch --unset-upstream xxx
    git push -u origin my_branch

##git pull
FETCH_HEAD:是一个版本链接,记录在本地的一个文件中,指向着目前已经从远程仓库取下来的分支的末端版本
git pull : 首先,基于本地的FETCH_HEAD记录,比对本地的FETCH_HEAD记录与远程仓库的版本号,然后git fetch 获得当前指向的远程分支的后续版本的数据,然后再利用git merge将其与本地的当前分支合并。

##git fetch
    git fetch -p    #fetch之后删除掉没有与远程分支对应的本地分支
    git fetch [remote responsity] [remote branch]:[local branch] #获取远端分支到本地
    git checkout -b [分支名] [远程名]/[分支名] #并创建本地分支


##merge
    git merge --no-ff -m {"merge with no-ff"} {merge branchname}


##git log
[Git日志](http://gitbook.liuhui998.com/3_4.html)
    git log --graph --pretty=oneline --abbrev-commit
    git log --author=bob
    --pretty 参数可以使用若干表现格式
    git log --pretty=oneline 
    git log --pretty=short
    git log --pretty=format:'%h was %an, %ar, message: %s'
    git log --pretty=format:'%h : %s' --graph

    git log --graph --oneline --decorate --all
    See only which files have changed:
    git log --name-status
    see more:
    git log --help


    git reflog show或git log -g命令来看到所有的操作日志
    误操作恢复的过程很简单:
    1. 通过git log -g命令来找到我们需要恢复的信息对应的commitid,可以通过提交的时间和日期来辨别  <git reflog show>
    2. 通过git branch recover_branch commitid 来建立一个新的分支
    这样,我们就把丢失的东西给恢复到了recover_branch分支上了




---
#git config common configuration
##gitignore 配置
删除已经commit的文件,但不删除文件本身 `git rm --cached filename`
[gitignore配置模板](https://github.com/github/gitignore)

## generate ssh
github sshkey 
ssh-keygen -t rsa -C "jasondliu@qq.com"

## account
git config --global user.name "JasonLiu798"
git config --global user.email "jasondliu@qq.com"

## format
git config --global color.ui true

##AutoCRLF
commit LF,chk out CRLF,win
    git config --global core.autocrlf true
commit LF,chk out nochange,mac
    git config --global core.autocrlf input
commit nochange,chk out nochange,linux
    git config --global core.autocrlf false

##SafeCRLF
refuse mix format
    git config --global core.safecrlf true
allow mix format
    git config --global core.safecrlf false
warn commit mix format
    git config --global core.safecrlf warn
    
##配色
git config --global color.ui auto
git config --global color.status auto  
git config --global color.branch auto
git config --global color.diff auto
git config --global color.interactive auto

##useful shortcut
co表示checkout,ci表示commit,br表示branch:
git config --global alias.co checkout
git config --global alias.c commit
git config --global alias.cl clone
git config --global alias.cam 'commit -a -m'
git config --global alias.cm 'commit -m'
git config --global alias.s status
git config --global alias.br branch
git config --global alias.bra 'branch -a'
git config --global alias.unstage 'reset HEAD'
git config --global alias.last 'log -1'
git config --global alias.lg "log "
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"

`git log颜色版`
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --graph --abbrev-commit"

`git log无颜色版(moba颜色显示有问题)`
git config --global alias.lg "log --pretty=format:'%t-%an-%cr-%s' --abbrev-commit" 
git config --global alias.lg "log --pretty=format:'%t-%an-%cr-%s' --abbrev-commit --graph"

###--pretty=format参数
%H   提交对象(commit)的完整哈希字串 
%h   提交对象的简短哈希字串 
%T   树对象(tree)的完整哈希字串 
%t   树对象的简短哈希字串 
%P   父对象(parent)的完整哈希字串 
%p   父对象的简短哈希字串 
%an  作者(author)的名字 
%ae  作者的电子邮件地址
%ad  作者修订日期-(可以用 -date= 选项定制格式)
%ar  作者修订日期-相对格式(1 day ago)
%aD  作者修订日期-RFC2822格式
%ar  作者修订日期-相对日期
%at  作者修订日期-UNIX timestamp
%ai  作者修订日期-ISO 8601 格式
%cn  提交者(committer)的名字 
%ce  提交者的电子邮件地址
%cd  提交日期-(--date= 制定的格式)
%cD  提交日期-RFC2822格式
%cr  提交日期-相对日期
%ct  提交日期-UNIX timestamp
%ci  提交日期-ISO 8601 格式
%d:  ref名称
%s:  提交的信息标题
%b:  提交的信息内容
%Cred: 切换到红色 
%Cgreen: 切换到绿色 
%Cblue: 切换到蓝色
%Creset: 重设颜色 
%C(...): 制定颜色, as described in color.branch.* config option 
%n:  换行
作者(author)和提交者(committer)之间差别:作者指的是实际作出修改的人,提交者指的是最后将此工作成果提交到仓库的人。所以,当你为某个项目发布补丁,然后某个核心成员将你的补丁并入项目时,你就是作者,而那个核心成员就是提交者


##git add proxy
http://segmentfault.com/q/1010000000118837

##ssh fix
~/.ssh/config
Host github.*
HostName github.com
PubkeyAuthentication yes
IdentityFile ~/.ssh/github

##策略设置
本地分支和远程分支的绑定(tracking),加上 rebase 策略:
[branch "master"]
    remote = origin
    merge = refs/heads/master
    rebase = true
更新代码(pull)的时候就会自动应用 rebase 而不是产生 merge commit,除非有其他情况产生,比如三方合并造成了冲突需要人共去干预。大部分时候还是很聪明的,只要团队里的习惯都良好,那么可以保持一个非常干净漂亮的树形。

---
#git server
sudo adduser git
sudo git init –bare sample.git
禁用shell登录
/etc/passwd文件完成。找到类似下面的一行:
git:x:1001:1001:,,,:/home/git:/bin/bash
改为:
git:x:1001:1001:,,,:/home/git:/usr/bin/git-shell
git clone git@server:/srv/sample.git
##公钥管理
/home/git/.ssh/authorized_keys文件里就是可行的。如果团队有几百号人,就没法这么玩了,这时,可以用Gitosis来管理公钥
要像SVN那样变态地控制权限,用Gitolite。

---
#submodule
http://blog.csdn.net/wangjia55/article/details/24400501

---
#其他
##彻底删除文件
http://www.cnblogs.com/shines77/p/3460274.html
## 权限管理
https://github.com/sitaramc/gitolite/
##清理svn
find . -type d -name ".svn"|xargs rm -rf
find . -type d -name ".settings"|xargs rm -rf
##不跟踪已commit的文件
git update-index --assume-unchanged /path/to/file
##修改最近一次提交的注释
git commit --amend
##moba
git-remote-ftp.exe: error while loading shared libraries:
apt-get install libopenssl100
apt-cyg install ca-certificates
cygcheck /usr/lib/git-core/git-remote-https.exe



---
#gitignore
```
# maven ignore
target/
*.jar
*.war
*.zip
*.tar
*.tar.gz

# eclipse ignore
.settings/
.project
.classpath
classes/

# idea ignore
.idea/
*.ipr
*.iml
*.iws

#python 
*.pyc

# temp ignore
*.log
*.cache
*.diff
*.patch
*.tmp
*.logs
*.bak
*.swp
*.swo

```


















分享到:
评论

相关推荐

    55links友情链接网址跟踪器

    55links友情链接网址跟踪器,放在桌面,每次直接打开就可以访问55links友情链接交易平台,方便快捷。

    [AB PLC例程源码][MMS_046180]CompactFlash Data Storage.zip

    AB PLC例程代码项目案例 【备注】 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用!有问题请及时沟通交流。 2、适用人群:计算机相关专业(如计科、信息安全、数据科学与大数据技术、人工智能、通信、物联网、自动化、电子信息等)在校学生、专业老师或者企业员工下载使用。 3、用途:项目具有较高的学习借鉴价值,不仅适用于小白学习入门进阶。也可作为毕设项目、课程设计、大作业、初期项目立项演示等。 4、如果基础还行,或热爱钻研,亦可在此项目代码基础上进行修改添加,实现其他不同功能。 欢迎下载!欢迎交流学习!不清楚的可以私信问我!

    moore_01_0909.pdf

    moore_01_0909

    FIBR English learning

    FIBR English learning

    [AB PLC例程源码][MMS_042350]How to send-receive SMS text messages using Westermo modem.zip

    AB PLC例程代码项目案例 【备注】 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用!有问题请及时沟通交流。 2、适用人群:计算机相关专业(如计科、信息安全、数据科学与大数据技术、人工智能、通信、物联网、自动化、电子信息等)在校学生、专业老师或者企业员工下载使用。 3、用途:项目具有较高的学习借鉴价值,不仅适用于小白学习入门进阶。也可作为毕设项目、课程设计、大作业、初期项目立项演示等。 4、如果基础还行,或热爱钻研,亦可在此项目代码基础上进行修改添加,实现其他不同功能。 欢迎下载!欢迎交流学习!不清楚的可以私信问我!

    OIF_IEEE802.3_liaison_19OCt09.pdf

    OIF_IEEE802.3_liaison_19OCt09

    SerU,做网络安全FTP内容的实验必备

    做网络安全FTP内容的实验必备

    nagarajan_01_1107.pdf

    nagarajan_01_1107

    [AB PLC例程源码][MMS_043879]Programming in SFC and ST Language.zip

    AB PLC例程代码项目案例 【备注】 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用!有问题请及时沟通交流。 2、适用人群:计算机相关专业(如计科、信息安全、数据科学与大数据技术、人工智能、通信、物联网、自动化、电子信息等)在校学生、专业老师或者企业员工下载使用。 3、用途:项目具有较高的学习借鉴价值,不仅适用于小白学习入门进阶。也可作为毕设项目、课程设计、大作业、初期项目立项演示等。 4、如果基础还行,或热爱钻研,亦可在此项目代码基础上进行修改添加,实现其他不同功能。 欢迎下载!欢迎交流学习!不清楚的可以私信问我!

    mellitz_3cd_01_0318.pdf

    mellitz_3cd_01_0318

    PyQt6实战派 配套代码

    PyQt6实战派 配套代码

    陕西省省级非物质文化遗产民俗经纬度数据统计表

    陕西省省级非物质文化遗产经纬度数据统计表 统计内容包含以下字段: 1. 项目名称 2. 遗产类别 3. 入选批次 4. 所属地区 5. 申报地区/单位 6. 地理经度 7. 地理纬度 该统计表系统记录了陕西省省级非物质文化遗产的地理空间信息,为文化遗产的数字化保护与研究工作提供了重要的数据支撑。

    ran_3ck_02a_0918.pdf

    ran_3ck_02a_0918

    毕业设计-基于springboot+vue开发的汽车租赁管理系统【源码+sql+可运行】50308.zip

    毕业设计_基于springboot+vue开发的汽车租赁管理系统【源码+sql+可运行】【50308】.zip 全部代码均可运行,亲测可用,尽我所能,为你服务; 1.代码压缩包内容 代码:springboo后端代码+vue前端页面代码; 脚本:数据库SQL脚本 效果图:运行结果请看资源详情效果图 2.环境准备: - JDK1.8+ - maven3.6+ - nodejs14+ - mysql5.6+ - redis 3.技术栈 - 后台:springboot+mybatisPlus+Shiro - 前台:vue+iview+Vuex+Axios - 开发工具: idea、navicate 4.功能列表 - 系统设置:用户管理、角色管理、资源管理、系统日志 - 业务管理:汽车管理、客户管理、租赁订单 3.运行步骤: 步骤一:修改数据库连接信息(ip、port修改) 步骤二:找到启动类xxxApplication启动 4.若不会,可私信博主!!!

    Runcorder - 跑步训练管理系统

    # Runcorder - 跑步训练管理系统 Runcorder 是一款专为跑步爱好者、马拉松运动员及高校体育生设计的本地化跑步训练管理工具,基于 Python 开发,结合 Tkinter 图形界面与强大的数据处理能力,为用户提供从训练记录到数据分析的全方位支持。无论是初学者还是专业跑者,Runcorder 都能帮助你科学规划训练、精准追踪进度,并通过可视化图表直观呈现训练成果,让你的跑步训练更智能、更高效! - **多用户管理**:支持创建、加载和删除用户档案,每个用户的数据独立存储,确保隐私与安全。 - **科学训练记录**:全维度记录跑步数据,包括日期、里程、配速、自评和晨跑标记,支持智能输入校验,避免数据错误。 - **多维数据分析**:通过动态可视化图表展示跑步里程趋势、平均配速曲线,支持自定义 Y 轴范围,帮助用户深入理解训练效果。 - **高阶功能**:提供 4 种科学训练模式(有氧/无氧/混合),支持历史记录修改与删除,数据以 JSON 格式持久化存储,跨平台兼容。

    paatzsch_01_0708.pdf

    paatzsch_01_0708

    开源AI工具下载——AnythingLLMDesktop1.7.3-r2 windows版

    AnythingLLM是一个全栈应用程序,您可以使用流行的开源大语言模型,再结合向量数据库解决方案构建个人本地AI大模型知识库

    mellitz_3ck_02_0519.pdf

    mellitz_3ck_02_0519

    petrilla_01_0708.pdf

    petrilla_01_0708

    ran_3ck_01_0918.pdf

    ran_3ck_01_0918

Global site tag (gtag.js) - Google Analytics