Deleting the .git folder can cause problems in the git repository. If you want to delete all commit history, but keep the code in its current state, you can do it safely as follows:
# Try running
git checkout --orphan latest_branch
# add all files
git add -A
# Commit changes
git commit -am "commit message"
# delete branch
git branch -D master
# Rename the current branch
git branch -m master
# Finally, force an update of the repository
git push -f origin master
Only push tag
# check latest tag
git describe
generate new tag
git tag -a release-v0.0.0 -m "msg"
push tag
git push origin release-v0.0.0
9. Push commit with tag
```sh
git add .
git commit -m "msg"
git pull
git describe
git tag -a release-v0.0.0 -m "msg"
git push --follow-tags
git undo commit
git reset HEAD .
merge branch
How to merge dev branch to main branch?
Submit the code of your own dev branch before merging
# 1. Enter the branch to be merged (if the dev branch is merged into main, enter the main directory)
git checkout main
git pull
# 2. Check whether all branches have been pulled down
git branch -a
# 3. Use merge to merge dev branch
git merge dev
# 4. View the status after the merger
git status
# 5. If there is a conflict, resolve the conflict through the IDE;
# 6. After resolving the conflict, submit the conflict file to the staging area
git add .
# 7. The result after submitting the merge
git commit -m "fix conflict"
# 8. Submit the local warehouse code to the remote warehouse
git push
pull develop branch
git fetch origin dev
git checkout -b dev origin/dev
git pull origin dev
Git global setup
Create a new repository
Push an existing folder
Set up local account to push an existing folder
Push an existing Git repository
Edit origin url
Delete all commit history in git
Deleting the .git folder can cause problems in the git repository. If you want to delete all commit history, but keep the code in its current state, you can do it safely as follows:
generate new tag
git tag -a release-v0.0.0 -m "msg"
push tag
git push origin release-v0.0.0
git undo commit
merge branch
How to merge dev branch to main branch?
Submit the code of your own dev branch before merging