This is the 11th day of my participation in Gwen Challenge

preface

This article describes some git instructions

1. An error occurs when deleting the local branch

Delete feature-echarts when the current branch is in feature-echarts, and an error occurs

git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks branch -d feature-echarts
error: Cannot delete branch 'feature-echarts' checked out at 'C:/GitCode/WayOnSpringBoot'
Completed with errors, see above.
Copy the code

To delete the current branch, switch to another branch.

2. Delete the remote branch

Git branch, click the picture below to go to the branch management page

What branches do you have on the remote end

git branch -a
Copy the code

delete

git push origin --delete feature-666
Copy the code

If there are too many branches and you enter the edit state, enter eq to exit

3.Merge

Do not want to merge, do not want to merge the code conflict is too much, this time to give up, re-pull, but found that the error cannot pull, can give up the local modification.

$ git reset --hard

HEAD is now at d4222ae 
Copy the code

All changes are discarded and cannot be retrieved. Be sure to discard the local file before performing this task!!

4. Find the files that are ignored

The gitignore file is ignored by some rules. For example, the gitignore file is ignored by SRC. Git 1.7.6 + git 1.7.6 + git 1.7.6 + git

git status --ignored
Copy the code

You can see all ignored files

Can see our new testDemo this file is ignored, the other is added before gitignore SRC file below before this rule will be tracking can also use the git check – ignore the full path to the file name

5. Git commit is ready to roll back to the remote test

git reset --hard origin/test
Copy the code

6. Git reporter refusing to merge suggested jobs

Git pull Origin Master where possible

7. Changes made to files on dev cannot be pushed to test after being deleted from test

Merge test into dev to make sure the code on both sides is consistent, and then revert the corresponding revert

8. The local commit has been committed, but there is no push

Select commit and reset before the commit to be withdrawn

Select soft, which will not discard the data in the local staging area. By command

git reset --soft origin/test
Copy the code

9. Multiple submissions at once

git -n revert 65616527d^.. 74ed3c768Copy the code

Just put the start and end commit in. The -n parameter allows multiple submissions to be reverted, while the -n parameter allows multiple submissions to be reverted

conclusion

Today we covered some git commands, so stay tuned for tomorrow’s post. See you in the next one!