侧边栏壁纸
  • 累计撰写 793 篇文章
  • 累计创建 1 个标签
  • 累计收到 1 条评论
标签搜索

目 录CONTENT

文章目录

简短命令

Dettan
2021-04-10 / 0 评论 / 0 点赞 / 170 阅读 / 559 字
温馨提示:
本文最后更新于 2022-07-23,若内容或图片失效,请留言反馈。部分素材来自网络,若不小心影响到您的利益,请联系我们删除。

git 版本管理库
在Linux 里输入命令。
git log 列出所有commits; git diff nameORdir 查看工作区与版本库的不同,+++是指的工作区的; git status 列出版本库的状态,包含文件的变动; git add fileORdir 将文件提交到现在的暂存区; git commit -m "descriot" 将暂存区的文件提交到版本库; git checkout --filename 撤销工作区的修改; git reset fileORdir 在暂存区删除文件; git reset --hard HEAD^ 恢复上一次的更改。如果是^^ 的话是两次的更改,多次用~n; git reset --hard sha号 恢复上一次的恢复,sha号就是git log 的commit号;
branch menerge:
git branch name ----- add a new branch to git git checkout name ------ switch to branch which name is where command gived git checkout -b name -------add a new branch and switch to it git branch -d name -------- will be deleted; we can specify more than one file for deletion;but the branch must be fully merge in his upstream branch;
git branch -D name ---------the com is also used to delete branch, the different with ahead is can delete the one not fully merged. git merge neme ------incorporates changes from the named commits into the current branch;
some question in branch switch: now if i have some changes have not commit to branch and i want switch to another branch,which I changed will loss.to solves this ,we can use git stash command to save our changes to somewhere and then we can ues git stash list to check and use git stash pop to Remove a single stashed stete in the stash list and apply it on top of the current working tree state.
git 往github推送
[] 表示可选 要先获取ssh key 才行 创建:git remote add [<选项>] shortname url
-f, --fetch 抓取远程的分支 --tags 抓取时导入所有的标签和关联对象 或不抓取任何标签(--no-tags) -t, --track <分支> 跟踪的分支 -m, --master <分支> 主线分支 --mirror[=] 把远程设置为用以推送或抓取的镜像
shortname 自定,以后操作用,
url进去github restore 点击clone or download,点击use ssh就有了
不用带参数,默认是把master当成远程库。 查看:git remote [-v] 下载 :git fetch shortname [branchname] 下载本地没有的 git pull shortname [branchname] 推送:git push shortname [branchname] 强制推送:git push -u jk +master

0

评论区