This article mainly combined with their own experience, to share the daily operation

Take Android Studio(IDEA) as an example, mainly GUI operations

Pull warehouse code

Switch branch

Adding a warehouse address

Sometimes we don’t have permission to submit code directly to the main repository and fork our own repository to commit, but we need to pull code from the main repository and then we need to track code from both repositories

Pull the commit code

Save temporary code

Restore temporary code

Code the rollback

There are generally two scenarios

1. Delete the branch and then resubmit the branch

Delete the local branch with the problem pull the latest branch code from the remote repository use cherry-pick to pull commit from the newly created branchCopy the code

Ex. :

I have two local submissions. Submission 2 cannot go online while submission 1 can go online

To solve

Start by creating a new local branch B

Delete local branch A (modified branch)

Pull the remote A branch

Switching branch information

Select the commit to be committed and use cherry-pick

And the code that was written before is kept in the local B branch

2. Rollback using REVERT is equivalent to resubmitting code

Combine multiple submissions into one using Rebase

Normally committing a COMMIT might involve writing random commit information

A requirement commits several times locally

This makes submitting records look messy

This needs to use the command line

complete

After learning the above points, you can deal with most scenarios basically. No more worrying about picking up the wrong code, deleting the wrong branch

There is a principle to using Git:

Local branches and code can be messed with, but do not mess with remote branches