...see more
git checkout -b feature/my-new-branch
# add/edit files
git add .
git commit -m "Meaningful message"
git push --set-upstream origin feature/my-new-feature
# do a pull request using the Azure DevOps
...see more
git checkout master # there should not be any other branches you care about at this stage
git pull
git checkout -b ... # continue as above
...see more

I made changes to the master branch which should be in a feature branch

git stash   # save local changes to the stash
git checkout -b feature/my-new-feature
git stash pop # put back local changes on the new branch
...see more

I made changes that I don't want

git reset HEAD --hard # Danger!
...see more

I want to delete my latest (local) commit but keep my files

git reset HEAD^1
...see more

I want to add changes to the latest (local not-synced) commit

git commit -m "Updated message" --amend # or
git commit --amend
...see more

Someone made changes to the master branch while I was working on my own feature branch

git commit ... # commit your changes
git rebase origin/master

Comments

Leave a Comment

All fields are required. Your email address will not be published.