学习笔记之Git / Gitflow / TortoiseGit

All contents are moved to haoran119/learning-notes (github.com).


Git - Wikipedia

Gitflow Workflow | Atlassian Git Tutorial

Introducing GitFlow

Pull Requests and Gitflow

  • https://blog.axosoft.com/pull-requests-gitflow/?utm_campaign=GitKraken%20Promos&utm_medium=email&_hsenc=p2ANqtz--5kZ-hsMZwcIFWuqofU-Oa0iqSOfNS72XNKNaK7CpgtDt6A865oAJYYgDGwDy9KV3_VBTX1DzFJun_PtkOHa1HRm5ptQ&_hsmi=61804615&utm_content=61804282&utm_source=hs_email&hsCtaTracking=61c5ea4a-e8bd-4ffd-bdfa-7de19a1b53e1%7Cfba6e886-1dff-473b-8c6b-f5a02ebef2c2
  • In my previous post, I discussed the Gitflow model and how it helps enterprises manage releases. In this post, I will be discussing pull requests and their importance in the development process.

TortoiseGit – Windows Shell Interface to Git

  • https://tortoisegit.org/
  • TortoiseGit provides overlay icons showing the file status, a powerful context menu for Git and much more!

TortoiseGit - Wikipedia

  • https://en.wikipedia.org/wiki/TortoiseGit
  • TortoiseGit is a Git revision control client, implemented as a Windows shell extension and based on TortoiseSVN. It is free software released under the GNU General Public License.
  • In Windows Explorer, besides showing context menu items for Git commands, TortoiseGit provides icon overlays that indicate the status of Git working trees and files.
  • It also comes with the TortoiseGitMerge utility to visually compare two files and resolve conflicts.

TortoiseGit - 维基百科,自由的百科全书


Git 教程 | 菜鸟教程

如何优雅地向别人介绍Git - 机器之心

  • https://mp.weixin.qq.com/s/79Aug3YQzS5-IuJlg46ukg
  • 本文主题是如何向工具初学者介绍分布式版本控制系统 Git。除了了解关于 Git 的基本知识以外,大家还可以学到一些工具学习方面的东西。
  • https://rachelcarmena.github.io/2018/12/12/how-to-teach-git.html

一篇文章,教你学会Git

Git入门

  • https://mp.weixin.qq.com/s/kreK2FlQ31VP2303FbpQzQ
  • 版本控制介绍

    • 什么是版本控制

    • 为什么要版本控制

    • 本地版本控制系统

    • 集中化的版本控制系统

    • 分布式版本控制系统

  • 认识 Git
    • Git 简史
    • Git 与其他版本管理系统的主要区别
    • Git 的三种状态
  • Git 使用快速入门
    • 获取 Git 仓库
    • 记录每次更新到仓库
    • 推送改动到远程仓库
    • 远程仓库的移除与重命名
    • 查看提交历史
    • 撤销操作
    • 分支
  • 推荐阅读

Git原理入门解析

20 分钟教你搞懂 Git!- 机器学习算法与Python学习

git 版本控制初学者指南

git 操作规范 - 程序猿

你可能会忽略的 Git 提交规范 - Linux学习

大厂 Git 提交规范

Git 分支设计规范


BEST PRACTICE

Git 12 岁了,为你送上 12 个 Git 的使用技巧! - Linux学习

10种Git技巧,让你省时省力又省心!

你可能不太会用的10个Git命令 - 机器之心

20 个最常用的 Git 命令用法说明及示例

工作流一目了然,动图展示 10 大 Git 命令

常用的Git命令清单

  • https://mp.weixin.qq.com/s/r68M3qQ3Ed1J5ge1kLxrYQ
  • https://blog.csdn.net/dqy19901103/article/details/107380601

团队开发中的 Git 实践

这有一份 Git 日常使用清单

Git 提交错了不用慌,这三招帮你修改记录

  • https://mp.weixin.qq.com/s/xtol-m1QDJPlJE74cBUAeQ
  • 修改最后一次提交
  • 修改多个信息
  • 顺序变更、合并、拆分
  • 最后的最后,大家需要注意,虽然这些手段在修改记录的时候非常好用。但是如果这些 commit 已经被提交到了远程,我们是不可以直接 git push 同步的。因为 git 会校验我们提交的 hash 值,发现对不上之后会禁止我们的提交。所以如果想要提交到远程的话,只能使用 git push -f 强制覆盖。但是这是一个非常非常危险的操作,如果你 git push -f 了,没有人会知道你到底修改了什么,只建议在自己独有的分支上如此操作,一定一定要谨慎使用。

通过 .git 目录深入理解 Git!

Merging vs Rebasing

git-blame - Show what revision and author last modified each line of a file

git-branch - List, create, or delete branches

  • https://git-scm.com/docs/git-branch#Documentation/git-branch.txt--d
  • How do I delete a Git branch locally and remotely? - Stack Overflow
  • Rename a local and remote branch in git – Multiple States Knowledge Base
    • https://multiplestates.wordpress.com/2015/02/05/rename-a-local-and-remote-branch-in-git/
    • 1. Rename your local branch.
      • If you are on the branch you want to rename:
        • $ git branch -m new-name
      • If you are on a different branch:
        • $ git branch -m old-name new-name
    • 2. Delete the old-name remote branch and push the new-name local branch.
      • $ git push origin :old-name new-name
    • 3. Reset the upstream branch for the new-name local branch.
      • Switch to the branch and then:
        • $ git push origin -u new-name

Git - git-bundle Documentation

Git Diff | Atlassian Git Tutorial

Git - git-gui Documentation

Git - gitk Documentation

Advanced Git Log | Atlassian Git Tutorial

  • https://www.atlassian.com/git/tutorials/git-log
  • The advanced features of git log can be split into two categories: formatting how each commit is displayed, and filtering which commits are included in the output.
    • $ git log -5
    • $ git log --after='2019-8-8'

Git - git-mv Documentation

Git Push | Atlassian Git Tutorial

Resetting, Checking Out & Reverting | Atlassian Git Tutorial

Git - git-reset Documentation

git stash - Saving Changes | Atlassian Git Tutorial

  • https://www.atlassian.com/git/tutorials/saving-changes/git-stash
  • git stash temporarily shelves (or stashes) changes you've made to your working copy so you can work on something else, and then come back and re-apply them later on. Stashing is handy if you need to quickly switch context and work on something else, but you're mid-way through a code change and aren't quite ready to commit.
  • $ git stash save "for debug use only" 
  • $ git stash list
  • $ git pull
  • $ git stash pop

How to create and apply changes in working directory ?

  • Create a git patch from the changes in the current working directory - Stack Overflow
    • https://stackoverflow.com/questions/5159185/create-a-git-patch-from-the-changes-in-the-current-working-directory
    • If you haven't yet commited the changes, then:
      • $ git diff > mypatch.patch
    • But sometimes it happens that part of the stuff you're doing are new files that are untracked and won't be in your git diff output. So, one way to do a patch is to stage everything for a new commit (git add each file, or just git add .) but don't do the commit, and then:
      • $ git diff --cached > mypatch.patch
    • Add the 'binary' option if you want to add binary files to the patch (e.g. mp3 files):
      • $ git diff --cached --binary > mypatch.patch
    • You can later apply the patch:
      • $ git apply mypatch.patch
    • Note: You can also use --staged as a synonym of --cached.

How to sync up feature branch with master branch code changes ?

  • Do git rebase to pick up the master branch code changes.
  • $ git fetch
  • $ git checkout feature/xxx
  • $ git rebase origin/master
  • If any issues, fix it and continue 
    • $ git mergetool
    • $ git rebase --continue
  • $ git push -f origin feature/xxx
  • git rebase | Atlassian Git Tutorial
    • https://www.atlassian.com/git/tutorials/rewriting-history/git-rebase
  • An introduction to Git merge and rebase: what they are, and how to use them
    • https://www.freecodecamp.org/news/an-introduction-to-git-merge-and-rebase-what-they-are-and-how-to-use-them-131b863785f/#:~:text=Rebase%20is%20another%20way%20to,from%20one%20branch%20to%20another. 

How to squash commits into one commit ?

  • Do git rebase -i to squash commits interactively. 
  • $ git fetch
  • $ git checkout feature/xxx
  • $ git rebase -i HEAD~7 # change 7 to the actual number of commits
  • Keep the top commit, and change others to 's' for squashing
  • Git - Rewriting History

How to merge feature branch into master ?

  • Swtich to feature branch and rebase
    • $ git fetch
    • $ git checkout feature/xxx
    • # note that git rebase origin/master may mess up the branch history
    • $ git rebase --preserve-merges origin/master
    • $ git push -f origin feature/xxx
  • Squash commits
    • $ git rebase -i HEAD~7 # change 7 to the actual number of commits
    • In the interactive mode, keep the top one commit, and change others from pick to s
    • $ git push -f origin feature/xxx
  • Swtich to master branch
    • $ git checkout master
    • $ git pull
  • Merge feature branch
    • $ git merge --no-ff feature/xxx
  • Check the merge locally
    • $ gitk
  • If it looks wrong, reset the changes
    • $ git reset --hard origin/master
  • Push merge to server
    • $ git push origin master
  • Check git tag
    • $ git fetch --tags
    • $ git describe

How to merge feature branch with conflict ?

How to restore lost commits ?

  • Git Cherry Pick | Atlassian Git Tutorial
  • https://www.atlassian.com/git/tutorials/cherry-pick
  • $ git fetch
  • $ git cherry-pick ***
posted on 2018-04-09 07:37  浩然119  阅读(1587)  评论(0编辑  收藏  举报