Git daily operations

1. Manually commit
git commit filename -m "comments"
git push

2. Branch rename
Delete remote branch:
git push --delete origin devel
Rename local branch:
git branch -m devel develop
Push local branch:
git push origin develop

3 . Undo the last commit
git reset --hard <commit_id>

git push origin HEAD --force


4. Undo local uncommitted operations

git reflog
git reset --hard version number git

checkout version number, pull code with a specific version number
checkout -b new branchname
git push creates a new branch

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326087925&siteId=291194637