Skip to content

Latest commit

 

History

History
59 lines (40 loc) · 1.81 KB

.tips.md

File metadata and controls

59 lines (40 loc) · 1.81 KB

Bringing a branch back in line with main

From here.

To reset a Git branch to match the main branch, you can use the git reset command, as follows:

  1. Make sure you are on the branch you want to reset:

    git checkout YOUR_BRANCH
  2. Update your local branch with changes from the remote branch (main):

    git fetch origin main
  3. Reset the local branch to the most recent commit of the remote branch (main):

    git reset --hard origin/main

    This git reset --hard command will discard all local changes in your branch and set the branch to the same commit as the remote main branch.

  4. Force update the remote branch:

    git push origin YOUR_BRANCH --force

    Note: Using --force with git push will rewrite the history of the remote branch. This can cause issues if others are collaborating on the same branch. Make sure no one else is working on the branch or communicate with your team before using --force.

It's important to note that these commands will not directly affect the main branch. They focus on changing the branch you are currently working on (in this case, YOUR_BRANCH) to match the current state of the main/main. This will not impact the main branch directly.

For a range of different git ops, this seems like a good resource to look at in more detail.

TMUX

launching tmux with a config file (for a four pane window):

tmux new-session -s SESSION "tmux source-file ~/tmux.conf"
  • change SESSION name accordingly
  • tmux.conf:
new
neww
splitw -v
splitw -h
select-pane -t 0
splitw -h
select-pane -t 0
set -g mouse