-
Notifications
You must be signed in to change notification settings - Fork 5
Git
Chamudi R Wijesekera edited this page Jul 17, 2021
·
3 revisions
git checkout main
git pull --ff-only origin main
git remote prune origin
create new branch
git branch <branchname>
Create a new branch and switch to it
git checkout -b <branchname>
Switch from one branch to another
git checkout <branchname>
Create a new branch to specific # code
git checkout -b <branchname>
git reset —hard <hash cord>
Rename branch
git branch -M new-name
Delete branch
git branch -d <branchname>
git branch -D <branchname>
Check all local and remote branches
git branch -a
Commit and Push
git add something.ts
git commit -m “commit-msg here”
git push origin <branch-name>
Remove origin branches that were deleted remotely
git remote prune origin
git fetch --prune
Check working tree is clean
git status
Unset upstream and get new changes from main
git checkout main
git branch --unset-upstream
git branch -m old_main
git fetch
git checkout main