Working with a Git Branch
Assuming a main branch you do not push to and a personal one you do. Changes make it to main via PR process
Personal Branch Setup
git clone git@SomeServer:SomeProject.git
cd SomeProject
git remote add jsnuffy git@SomeServer:joe-snuffy/SomeProject.git
git remote set-url --push origin no_push
Create New Branch
git checkout -b my_feature
Normal day (assuming existing my_feature branch)
git checkout main
git pull
git checkout my_feature
git rebase main
--- happly hacking away ---
--- decide it is time to commit your changes ---
(still on my_feature branch)
pull down any changes
git checkout main
git pull
git checkout my_feature
git rebase main -i
get rid of any commits that are not useful to end up in history
Send to server
git push jsnuffy
--- create Pull Request and have it commited ---
Once commited pull down those changes into main.
git checkout main
git pull
Once that is done and assuming the commit was unchanged you should should be able to:
git branch my_feature -d
Above will only work if the commit is in main. If there was changes then use -D.. The -D should only be necessary if changes were made by other than you during the PR process.