Skip to content

Hate my git practice

Leo Leung edited this page Jan 4, 2024 · 3 revisions

Rebase!

  • If your commits in your branch are too long, you can rebase your own branch to squash the commits into one.
    git log # to find a base
    git rebase {hash} -i
    # within the vim
    %s/pick/fixup/g
    - the first one to turn back to pick
    # 
    git diff origin/features/brancha --name-only # to check changed file names
    
  • Rebase the target branch,
    git rebase origin/development
    git push --force # if you are confident... ignore x pulls and y pushes.
    
  • Rebase tricks
    • If you want to accept all current/incoming, you can right click file in source control tab of vscode.
  • If you use poetry, regenerate poetry lock,
    poetry install
    poetry lock
    
  • Merge in dev without squash, but dev to test or test to prod should squash.
Clone this wiki locally