livelesson-git

  • e5_492333
    了解作者
  • 2.8KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-04-05 02:44
    上传日期
Git笔记 在本地使用git git init :将当前文件夹初始化为git仓库 git clone <URL> :将git repo从当前文件夹 git status :告诉我们我们需要了解的关于存储库的信息 git add <FILE> :添加到暂存区 git commit :打开文本编辑器以编写提交消息 git commit -m "MESSAGE" :将MESSAGE作为提交写入,而没有文本编辑器 git log :显示我们提交的日志(历史) git log --oneline :显示较短的git log --oneline提交 git diff :比较当前未提交状态和上一个已知的git状态 git diff --staged :在临时区域和最后一个已知状态之间运行git diff git diff HEAD~<NUMBER> :比较HEAD与提交前(相对) git dif
livelesson-git-main.zip
  • livelesson-git-main
  • docs
  • doc.pdf
    0B
  • doc.png
    0B
  • output
  • .gitkeep
    0B
  • .gitignore
    6B
  • README.md
    3.7KB
  • .gitignore
    28B
内容介绍
# Git Notes ## Working with git locally - `git init`: initialize current folder as a git repository - `git clone <URL>`: brings the git repo from <URL> to current folder - `git status`: tells us what we need to know about our repository - `git add <FILE>`: adds <FILE> to the staging area - `git commit`: open a text editor to write commit message - `git commit -m "MESSAGE"`: writes MESSAGE as a commit without a text editor - `git log`: shows the log (history) of our commits - `git log --oneline`: shows the shorter oneline commit - `git diff`: compare current uncommited state with last known git state - `git diff --staged`: runs git diff between the staging area and last known state - `git diff HEAD~<NUMBER>`: compares HEAD with commit <NUMBER> ago (relative) - `git diff <HASH>`: compares HEAD with the commit in <HASH> - `git restore --source <HASH OR HEAD~> <FILE>`: restore file to <HASH OR HEAD~> - `git checkout <HASH OR HEAD~> <FILE>`: restores file to <HASH OR HEAD~> - `git checkout <HASH OR HEAD~>: if you forget the file, you end up in detached head state - `git checkout main`: go back to main - `git switch main`: go back to main ## Working with remotes - `git remote add <NAME> <URL>`: adds the <URL> as a remote with the name <NAME> - <NAME> is by convention called `origin` - `git remote rm <NAME>`: removes the remote called <NAME> - ` git remote -v`: look at all the remotes you have - `git push <WHERE> <WHAT>`: pushes the <WHAT> branch to <WHERE> - `git push origin main` - `git pull <WHERE> <WHAT>`: pulls the <WHAT> branch in <WHERE> to local computer ## Branches - `git branch <NAME>`: create branch <NAME> where you are (HEAD) - `git switch <NAME>`: move to the branch <NAME> - `git checkout <NAME>`: also move to the branch <NAME> - `git swich -c <NAME>`: create and move to the branch <NAME> in 1 command - `git checkout -b <NAME>`: also create and move to branch <NAME> in 1 command - `git merge <BRANCH>`: merge <BRANCH> into your current branch - `git rebase`: command to change the history of a commit - Commits from `git merge` can be automatically combined - `git rebase <BRANCH>`: incorporate changes from <BRANCH> into current branch - `git status`: is your friend - `git add <FILE>`: to mark conflict resolution - `git rebase --continue`: move to next commit in rebase - `git rebase --abort`: undo git rebase step - `git rebase -i <COMMIT>` `HEAD~` or <HASH> of commit to go into interactive rebase - you can make multiple commit changes here, e.g., `squash`/`s` - `git rebase -i <HASH>^`: use ^ to include that commit in interactive rebase - `git stash` or `git commit`: to save work before moving branches - `stash` is temporary - `git stash list`: see your stashed commits - `git stash apply`: apply your last stashed commit - `git stash clear`: clean up your stashes - A `merge` on the remote is called a "pull request" or "merge request" - `git push <WHERE> <WHAT>` - To update a PR, we make the changes to the branch locally and re-`push` - A merge conflict can happen after a PR is issued. - `git fetch`: update your git log without making any changes to your files - `git fetch --prune`: update your log and also remove deleted remote branches - `git push -f <WHERE> <WHAT>`: force push to the remote <WHERE> the branch <WHAT> - `git push --force-with-lease <WHERE> <WHAT>`: more mindful of collaborators ## Collaborators - Second person to push, needs to sync the history - Add collaborators in repository settings - collaborators will then `git clone <URL>` to get repo on their computer - Each person's branch changes are independent from one another - Feature branches won't show conflicts until one of them is merged first
评论
    相关推荐
    • atombook:Atom.io 编辑器的 Gitbook 集成
      原子书 Atom.io 编辑器的集成。
    • Splitdown, 像 Markdown 编辑器替换一样的Ghost.zip
      Splitdown, 像 Markdown 编辑器替换一样的Ghost #Splitdown WordPress的Markdown 编辑器替换安装将插件克隆到插件目录中,通常位于内容/插件。你需要运行 git submodule init 和 git submodule update 来拉 show
    • svgeditor:SVG模式编辑器上的React
      Svg Shcema编辑器 在react svg + redux上进行的原理图编辑器。 版本转换为Immutable.js 事件处理的概念已经改变。 现在,这些组件不处理事件,而是将其转变为高级操作。 所有mouseDown,mouseUp,mouseMove事件均按...
    • mobile 注册表编辑器
      可以查看mobile手机的注册表,相当于windows上面的redegit
    • atom-git-grep:原子编辑器中的git-grep
      原子编辑器中的git grep 。 安装 apm install git-grep 如何使用 根据需要设置keybind.cson。 ' .workspace ' : ' cmd-k cmd-g ' : ' git-grep:grep ' # default git grep根始终是工作空间的当前根。
    • Atom-git-blame,Atom编辑器插件。切换Git.zip
      Atom-git-blame.zip,Plugin for Atom Editor. Toggle git-blame annotations for the current file in the gutter.怪罪,atom是一个用web技术构建的开源文本编辑器
    • Atom-git-commit-atom,在当前atom窗格中轻松编辑git提交消息.zip
      Atom-git-commit-atom.zip,在当前atom窗格中轻松编辑git提交消息git提交原子,atom是一个用web技术构建的开源文本编辑器
    • git_kv_store_tutorial:探索git
      探索Git:从git init到KV商店 ...如果我们在编辑器中检出.git子目录: $ tree .git .git ├── branches ├── config ├── description ├── HEAD ├── hooks │ ├── applypatch-msg.samp
    • EditAndPublishArticle编辑器
      作者zhaoquntao,源码EditAndPublishArticle,虽然编辑和发布文章,现在很少app用到.由于公司的项目中用到了,我把这部门内容分离出来,写了一个demo分享给大家,还有一些需要完善的地方,多谢理解. gihub:/zhaoquntao/...
    • GaussDB_100_1.0.1-DATABASE-REDHAT-64bit.tar.gz
      guassdb100在redhat上安装包,单机部署的包,安装步骤请看我的文中介绍,经过大量实验搭建总结出来的文档