binzunu1909 / ui-test-selenium

Testing on Web API server about School Management
1 stars 0 forks source link

GIT GUIDE #21

Open Bisllly opened 1 year ago

Bisllly commented 1 year ago

To create a new Git branch to manage changes before merging, you can follow these steps:

  1. Make sure you have a clean working directory by committing or stashing any changes you have made.
  2. Ensure you are on the branch from which you want to create a new branch. You can use the git branch command to check your current branch and switch to the desired branch using git checkout <branch-name>.
  3. Once you are on the desired branch, use the git branch <new-branch-name> command to create a new branch. For example, git branch feature-branch.
  4. Switch to the newly created branch using git checkout <new-branch-name>. In our example, git checkout feature-branch.
  5. Now you are on the newly created branch and can start making changes specific to this branch.
  6. Make your changes, stage them using git add, and commit them using git commit.
  7. Repeat step 6 as needed to add more changes to the branch.
  8. When you are ready to merge your changes back to the original branch, switch back to that branch using git checkout <original-branch-name>.
  9. Use the git merge <new-branch-name> command to merge the changes from the new branch to the original branch.
  10. Resolve any merge conflicts if they occur. Git will prompt you to resolve conflicts manually if changes conflict between branches.
  11. Once the merge is successful, you can continue working on the original branch or delete the new branch using git branch -d <new-branch-name>.

Following these steps will allow you to create a new branch, make changes specific to that branch, and merge them back into the original branch when you're ready.

Bisllly commented 1 year ago

Disable rebasing when pulling the changes from remote branch Git config pull.rebase false

Make your local doesn’t have changes when merging (pulling) from remote Git pull origin main _ git fetch origin main && git merge origin main

If local still have changes that are un-tracked. Git stash -m “this is a not, squash me later”

  • Store current changes into stack list

Resolve conflict if have. Then git stash pop to take out the stored changes

Then commit your changes > Create PR