10x Developer
  • Introduction
  • HTML
    • HTML DOM Jquery
    • HTML: Form
    • CSS
    • CSS Layout
    • CSS Flexbox
    • CSS Grid
    • SASS/LESS
    • CSS/LESS/SASS Cookbook
    • Bootstrap
  • JavaScript
    • JavaScript
    • ES6
    • TypeScript
    • JavaScript Testing
    • JavaScript Event Loop
    • DOM
    • Web APIs
    • JSON
    • RegEx
    • Functional Programming
    • JavaScript Lib
    • CoffeeScript
    • CoffeeScript to ES6 cheatsheet
  • Angular.js
    • Angular
    • Angular Cookbook
    • Angular Mistakes I Made
    • Angular 1.x
  • React.js
    • React.js
  • Node
    • Node.js
    • CLI command line tool
    • Electron / Atom
    • NW.js (node-webkit)
  • Serverless
    • AWS Lambda
    • Google Cloud Function
    • Actions on Google / Google Assistant
  • Full Stack Development
    • HTTP
    • Meteor
    • MongoDB
    • Digital Ocean
    • UI
    • Sketch
    • Web Dev Resources
  • Lang
    • Ruby
  • Know Your Tools
    • Chrome DevTools
    • Editor: VS Code
    • Editor: Vim
    • Editor: Sublime
    • Editor: Atom
    • Windows
    • Git
    • Linux / Bash
    • Mac
  • Cheatsheets
Powered by GitBook
On this page
  • Common comands
  • Custom bash function
  • Tips: merge base when you have changes already commited locally
  • Alias Command
  1. Know Your Tools

Git

PreviousWindowsNextLinux / Bash

Last updated 6 years ago

Links:

  • Cheat sheet:

  • Git Reference:

  • Play this:

  • 中文教程: and

Topics:

  • How to Fork boilerplate to other branch, see examples from:

Common comands

# merge from staging
git merge origin/staging

Custom bash function

# add this to .zshrc

# usage: newUS sprint15/US-12345
function newUS() {
  git checkout -b feature/$1 --no-track origin/staging
}

# create PR on bitbucket from current branch to feature/paycard-staging
# you should publish the branch first: git push -u first
function newPR() {
  branch_name="$(git symbolic-ref HEAD 2>/dev/null)"
  open "https://bitbucket.com/sourceBranch=${branch_name}&targetRepoId=6565" 
}

Tips: merge base when you have changes already commited locally

git reset --soft "HEAD^"
git stash
git merge origin/feature/paycard-staging
git stash apply
git add .
git commit

Alias Command

~/.gitconfig

[alias]
    ac = !git add -A && git commit -am
    s = status
https://github.com/trufa/git-cheatsheet
http://gitref.org/index.html
https://github.com/Gazler/githug
史上最浅显易懂的Git教程
猴子都能懂的GIT入门
https://github.com/koistya/react-static-boilerplate/tree/master