Git and GitFlow

Git

Ref: https://www.atlassian.com/git/tutorials/using-branches

  # to create a new branch and checkout to that branch
  git branch new-feature
  git checkout new-feature

  #to checkout a new branch
  git checkout -b <branch name>

  # to see all branches checkout out
  git branch

  # to switch to another branch (just do not use the -b option)
  git checkout <branch name>


  # To add a user to the git global config, before commit and push.
  # This will create the profile in ~/.gitconfig
  git config --global user.email "develamit@gmail.com"
  git config --global user.name "develamit"

  # To add a user locally - this will create the user profile in .git/config
   git config user.name develamit
   git config user.email develamit@gmail.com

  # For git submodule:
  https://github.com/blog/2104-working-with-submodules

  # For git pull request
  https://help.github.com/articles/creating-a-pull-request/

  #You can store your credentials using the following command, so that it does not ask for username,
  password everytime
  git config credential.helper store
  git push http://example.com/repo.git
  Username: <type your username>
  Password: <type your password>

  # to change the commit user
  git commit --amend --author="John Doe <john@doe.org>"


  #If you want to overwrite only one file:
   git fetch
   git checkout origin/master <filepath>

  #If you want to overwrite all changed files:
   git fetch
   git reset --hard origin/master

  # after adding a file, if you want to revert back
  git reset HEAD <file name>

Duplicating an old repo to a new repo

Ref: https://help.github.com/en/articles/duplicating-a-repository

RESETTING TO A COMMIT

Ref: https://stackoverflow.com/questions/1895059/revert-to-a-commit-by-a-sha-hash-in-git

TAGGING

.gitignore

UPDATE BRANCHES

GitFlow

Ref: https://github.com/nvie/gitflow/wiki/Mac-OS-X

Ref: https://github.com/nvie/gitflow

Git LFS (large file system)

Ref: https://github.com/git-lfs/git-lfs/wiki/Installation#ubuntu

Last updated

Was this helpful?