cloud,

Git - Tips and Notes

Gineesh Gineesh Follow · 1 min read
Git - Tips and Notes
Share this

Git Cheat Sheet

# Checkout a new branch
git checkout -b new-branch

# push new branch to remote
git push -u origin new-branch
git push --set-upstream origin new-branch

# fetch the latest changes from remote
git fetch origin

# Merge the latest main into your branch
git merge origin/main

How to clean Git commit history

# Create Orphan Branch
git checkout --orphan temp_branch

# Add Files to Branch and commit
git add -A
git commit -am "the first commit"

# Delete master Branch
git branch -D main

# Rename temp/Current Branch to master
git branch -m main

# Push Changes to repo as master
git push -f origin main

Original post: How to Delete Commit History in Github

Gineesh
Written by Gineesh Follow
Author, Automation and Containerization Guy, techbeatly.com/youtube

Latest Stories

Featured