install go
go website : https://golang.org/dl/
wget https://storage.googleapis.com/golang/go1.7.4.linux-amd64.tar.gz
#解压后添加环境变量即可 加在~/.bashrc中
export GOROOT=$HOME/go
export GOPATH=$HOME/gopath
export PATH=$PATH:$GOROOT/bin
source ~/.bashrc
go version
想重新编译:https://golang.org/doc/install/source#go14
install gogs
refer:https://gogs.io/docs/installation/install_from_source
# 下载并安装依赖
$ go get -u github.com/gogits/gogs
# 构建主程序
$ cd $GOPATH/src/github.com/gogits/gogs
$ go build
##网络不通最终二进制安装 tsinghua@1988@@@@下载后直接启动
第一个用户就是管理员用户~
git使用
1,本地记住密码
.git/config中加两行
[credential]
helper = store
2,.gitignore不起使用
git rm -r --cached .
git add .
git commit -m 'update .gitignore'
git 回滚
it revert是用一次新的commit来回滚之前的commit,git reset是直接删除指定的commit
git 命令
比较项目 Git 命令 SVN 命令
URL git://host/path/to/repos.git svn://host/path/to/repos
ssh://user@host/path/to/repos https://host/path/repos
file:///path/to/repos file:///path/to/repos
user@host:path/to/repos
/path/to/repos.git
版本库初始化 git init[--bare]<path> svnadmin create<path>
导入数据 git clone; git add; git commit svn import<path><url>-m
版本库检验出 git clone<url><path> svn checkout<url/of/trunk><path>
版本库分支检出 git clone -b <branch><url><path> svn checkout<url/ofranches/name><path>
工作区更新 git pull svn update
更新至历史版本 git checkout <commit> suv update -r <rev>
更新到指定日期 git checkout HEAD@'{<date>}' git update -r {<date>}
更新至最新提交 git checkout master git update -r HEAD
切换至里程碑 git checkout <tag> svn switch<url/of/tags/name>
切换至分支 git checkout <branch> svn switch<url/of/branches/name>
还原文件/强制覆盖 git checkout --<path> svn revert<path>
添加文件 git add <path> svn add <path>
删除文件 git rm <path> svn rm <path>
移动文件 git mv <old> <new> svn mv <old><new>
清除未跟踪文件 git clean svn status | sed -e??
清除工作锁定 _ svn clean
读取文件历史版本 git show <commit>:<path>><output> svn cat -r<rev><url/of/file>@<rev>><output>
反删除文件 git add <path> svn cp -r
工作区差异比较 git diff
git diff --cached
git diff HEAD svn diff
版本间差异比较 git diff <commit1><commit2>--<path> svn diff -r <rev1>:<rev2><path>
查看工作区状态 git status -s svn status
提交 git commit -a -m "<msg>":git push svn commit -m "<msg>"
显示提交日志 git log svn log | less
逐行追溯 git blame git blame
显示里程碑/分支 git tag
git branch
git show -ref svn ls <url/of/tags/>
svn ls <url/of/branches/>
创建里程碑 git tag [-m "<msg>"]<tagname> [<commit>] svn cp <url/of/trunk><url/of/tags/name>
删除里程碑 git tag -d <tagname> svn rm <url/of/tags/name>
创建分支 git branch <brach> <commit> git checkout -b <branch><commit> svn cp <url/of/trunk> <url/braches/name>
删除分支 git bracn -d<branch> svn rm <url/of/branches/name>
导出项目文件 git archive -o <output.tar><commit> svn export -r <rev> <path><oupt/path>
svn export -r <rev><url><output/path>
反转提交 git revert<commit> git merge -c <rev>
提交练选 git cherry-pick<commit> git merg -c <rev>
分支合并 git merge <branch> svn merge <url/of/branch>
冲突解决 git mergetool
git add <path> svn resolve --accept = <ARG><path>
svn resolved<path>
显示文件列表 git ls-files
git ls-tree<commit> git ls
git ls <url> -r <rev>
更改提交说明 git commit -amend svn ps -revprop -r <rev>svn:log "<<msg>"
撤销提交 git reset[--soft|hard]HEAD^ svnadmin dump, svnadmin load ,svndumpfiler
属性 .gitignore 文件
text 属性
eol 属性
git submodule 命令 svn :ignore
svn: mime-type
svn:eol-style
svn:externals
本文介绍如何安装Go语言环境,并提供了一系列Git的基本使用技巧和命令,包括环境配置、基本操作、版本管理等。
646

被折叠的 条评论
为什么被折叠?



