查看GNU/Linux Tips的源代码
←
GNU/Linux Tips
跳转到:
导航
,
搜索
因为以下原因,你没有权限编辑本页:
您刚才请求的操作只有这个用户组中的用户才能使用:
用户
您可以查看并复制此页面的源代码:
== Git == git diff的时候忽略换行符的差异: git config --global core.whitespace cr-at-eol http proxy: git config --global http.proxy 'socks5://127.0.0.1:8080' git server: <source lang=bash> $ apt-get install git-daemon-sysvinit $ cat /etc/default/git-daemon GIT_DAEMON_ENABLE=true GIT_DAEMON_USER=gitdaemon GIT_DAEMON_DIRECTORY=/var/data/git GIT_DAEMON_BASE_PATH=/var/data/git GIT_DAEMON_OPTIONS="--export-all --enable=upload-pack --enable=upload-archive --enable=receive-pack --informative-errors" </source> 修改.git/config添加如下代码: <pre> [receive] denyCurrentBranch = ignore </pre> 在初始化远程仓库时最好使用 git --bare init 而不要使用 git init 如果使用了git init初始化,则远程仓库的目录下,也包含work tree,当本地仓库向远程仓库push时, 如果远程仓库正在push的分支上(不在push分支,没有问题), 那么push后的结果不会反应在work tree上, 也即在远程仓库的目录下对应的文件还是之前的内容,必须得使用git reset --hard才能看到push后的内容 <br><br> === Tag === 列显已有的标签: <source lang=bash> $ git tag v0.1 v1.3 $ git tag -l 'v1.4.2.*' v1.4.2.1 v1.4.2.2 v1.4.2.3 </source> 创建 Tag: <source lang=bash> $ git tag -a v1.4 -m 'my version 1.4' $ git tag v1.4-lw $ git tag -s v1.5 -m 'my signed 1.5 tag' </source> 后期加注标签: <source lang=bash> $ git log --pretty=oneline 15027957951b64cf874c3557a0f3547bd83b3ff6 Merge branch 'experiment' a6b4c97498bd301d84096da251c98a07c7723e65 beginning write support 0d52aaab4479697da7686c15f77a3d64d9165190 one more thing $ git tag -a v1.2 0d52aaab </source> 本地 Tag 推送到远程: <source lang=bash> $ git push --tags </source> 获取远程 Tag: <source lang=bash> $ git fetch origin tag <tagname> </source> 删除远程 Tag: <source lang=bash> $ git push origin --delete tag <tagname> </source> <br><br> === submodule === ;;关联: <source lang=bash> $ git submodule add git://github.com/icamgo/xtensa-toolchain.git tools/xtensa-toolchain $ git status new file: .gitmodules new file: tools/xtensa-toolchain $ cat .gitmodules [submodule "tools/xtensa-toolchain"] path = tools/xtensa-toolchain url = git://github.com/icamgo/xtensa-toolchain.git $ git commit -a -m "add the xtensa-toolchain as submodule" $ git push </source> ;;使用 <source lang=bash> $ git submodule init $ git submodule update </source> * http://www.kafeitu.me/git/2012/03/27/git-submodule.html <br><br> === Remove === First, remove the commit on your local repository: <source lang=bash> $ git reset --soft HEAD^ </source> Then, force push to GitHub by using: <source lang=bash> $ git push origin +master </source> <br><br> === Remove from upstream === using https://rtyley.github.io/bfg-repo-cleaner/ <source lang=bash> $ bfg --strip-blobs-bigger-than 50M # Git history will be cleaned - files in your latest commit will *not* be touched </source> <br><br> === Branch === * https://git-scm.com/book/zh/v1/Git-%E5%88%86%E6%94%AF-%E8%BF%9C%E7%A8%8B%E5%88%86%E6%94%AF ==== push ==== $ git push origin local_branch <br><br> ==== delete ==== $ git push origin :remote_branch <br><br> === Merge === ==== git cherry-pick ==== 55e0513c is at branch devel, we merge it into master: <pre> $ git checkout master $ git cherry-pick 55e0513c </pre> <br><br> === Patch === export all the 19 commits: <pre> $ git format-patch -s -p --stat -19 -o /tmp/ </pre> <br><br> === Bitbucket === Get started with an existing project: <source lang=bash> $ cd /path/ to/your/repo $ git remotee add origin ssh://git@bitbucket.org/YOUR_UNAME/repo.git $ git push -u origin master </source> Get started from scratch: <source lang=bash> $ git clone git@bitbucket.org:YOUR_UNAME/repo.git $ cd repo $ echo '# README' >> README.md $ git add README.md $ git commit -m "Initial commit" $ git push -u origin master </source> <br><br> === ssh agent === <source lang=bash> # start the ssh-agent in the background $ eval "$(ssh-agent -s)" Agent pid 59566 $ ssh-add ~/.ssh/id_rsa </source> <br> === Using SSH over the HTTPS port === ~/.ssh/config: <source lang=bash> Host github.com Hostname ssh.github.com Port 443 User git </source> Testing: <source lang=bash> $ ssh -T git@github.com > Hi USERNAME! You've successfully authenticated, but GitHub does not > provide shell access. </source> https://docs.github.com/en/authentication/troubleshooting-ssh/using-ssh-over-the-https-port <br><br>
返回到
GNU/Linux Tips
。
个人工具
登录
名字空间
页面
讨论
变换
查看
阅读
查看源代码
查看历史
操作
搜索
导航
首页
社区专页
新闻动态
最近更改
随机页面
帮助
工具箱
链入页面
相关更改
特殊页面