Notes of Nafi
  • Hello! 🖐
  • Cloud
    • AWS
    • GCP
    • Ansible
      • Desktop configuration
  • Web Dev
    • husky
    • Web Cache/HTTP Caching Headers
    • package manger
    • Webhook
    • ESLint
    • Back End
      • node.js
    • Front End
      • React
        • Lint
        • Next.js
      • Angular
      • Flutter
        • cubit
        • flutter
        • provider
      • Tailwind CSS
      • CSS
    • Lerna
    • nginx
  • Software Architecture
  • Startup
    • Legal Issues
  • Linux
    • Misc problems & solutions
    • CTF Tools
    • Network Tools
    • systemctl
    • terminal
      • dotfiles
      • tmux
      • zsh
      • command line tools
    • Git
      • merging strategy
      • git workflows
      • basics
  • Programming Language
    • JavaScript
      • misc
      • draft
    • C++
  • Google Docs
    • Spreadsheet
  • Design
  • Windows
    • Terminal
  • Similar websites
Powered by GitBook
On this page
  1. Linux
  2. Git

merging strategy

git rebase

Recommended by Alif Arfab

$ git checkout dev
$ git pull
$ git checkout bugfix/re-add-modal-fix
#remember to rebase your feature branch into protected branch(in our case; dev)
$ git rebase dev

#if there are conflicts in some files
#read instructions from the terminal and act accordingly

#terimal will give you hints to do the following 
$ git add .
$ git rebase --continue

#if there are conflicts in some files
#fix the conflicts and

$ git add .
$ git rebase --continue

#go on like this 
#till you have resolved conflicts throughout all the commits of 
#bugfix/re-add-modal-fix and dev

#now that you have resolved conflicts of all the commits
#you are free to commit your changes

$ git commit -m "rebased dev"
$ git pull
$ git push

#you are not done yet
#go to git remote repository to create a pull request
#while creating a pull request, make sure to check 
#1. squash commits
#2. close source branch

#now you are done 
#happy coding!

My rebase strategy (TODO: detail explanation with branch tree)

#checkout to feature branch
$ git checkout feature-branch

#do changes, then
$ git add .
$ git commit -m 'meaningful commit message'

#checkout to master branch and pull 
#the changes
$ git checkout dev
$ git pull

#now checkout to feature branch to rebase
$ git checkout feature-branch
$ git pull --rebase
$ git rebase dev

#now push & make a PR
#make sure to tick on close branch in PR
$ git push
PreviousGitNextgit workflows

Last updated 3 years ago