Git : helpful commands:
1. Undo local commit to master
I.
git checkout master
git reset --soft head~
1. Undo local commit to master
I.
git checkout master
git reset --soft head~
Or
git log --oneline
git reset commit#id#hash
#
git revert <revert_id> --no-edit
Or git reset HEAD~
2. git tagging
2. git tagging
git tag <tag_name> commit_id
git push origin --tags
git checkout -b branch_name tag_name
3. Cherry Pick:
Get the the merged commit SHA id
[after checking out the release branch
git cherry-pick -m 1 <<merged SHA ID>>
git status
git push
4. Checkout remote branch
git fetch
git checkout REMOTE_BRANCH
5. Git revert local commit to master
git reset --hard origin/master
6. Git checkout remote branch
git fetch
git branch -v -a
git switch new_branch_name
git pull origin master
git config pull.rebase false
git push
6. Git checkout a commitid
git checkout #commitId/commit-id-sha#
7. Git checkout from specific commitid on a new branch
git checkout -b <new-branch-name> <commit-id-sha>
No comments:
Post a Comment