12.20.2024 – Start Dev Work Session Commands


  1. First, ensure you’re on the correct branch:
bash
git branch
  1. If you need to switch branches:
bash
git checkout <branch-name>
  1. Fetch all remote changes to see what’s new:
bash
git fetch --all
  1. Pull the latest changes from the remote repository:
bash
git pull origin <branch-name>

If you’re working on a feature branch, you might also want to make sure it’s up to date with the main branch:

bash
git checkout <feature-branch>
git pull origin main

Delete all the local branches which aren’t in the repo anymore.

git branch --delete --force $(git branch -vv | grep ': gone]' | awk '{print $1}')

Delete stale branches


git fetch --prune 

Then you will have to delete the local stale branches.

# List all branches (both local and remote)
git branch -a

Then find the stale branch and run.

# Delete a local branch if needed
git branch -d <state_branch>

Use a lowercase -d when deleting as you will only delete stale branches this way.

Still looking into a way to do this seamlessly through VSCode, say after a Pull Request.

Getting Ahead: Your first 2,000 dollars on Upwork

$4.99

Are you a developer dreaming of location independence and a lucrative career? This ebook is your roadmap to success on Upwork, one of the world’s leading freelance platforms. Whether you’re a seasoned coder or just starting out, we’ll guide you through the most effective strategies to reach that crucial $2,000 milestone.

Category:

Leave a Reply