How to Commit the code to Same Review Branch in GIT


How to Commit the code to Same Review Branch in GIT

You already knew how to create a review branch from the following post

How to Commit your code to a branch in GIT

Now we will see how to update the same review branch code and commit new code to the same review branch.

First take the latest code from the GIT repository using git pull, after the get your review branch code into the same working directory by using the following command.

git pull origin /laxma.reddy/

Once you pull your branch code, then follow the same steps for committing the updated code into your review branch.

2. Create a new local branch as following
>> git branch
Ex: git branch test_branch

3. Switched to branch
>> git checkout
Ex: git checkout test_branch

Now you are in test_branch, When you create a new branch in GIT it will create a new branch with the existing code.

4. Now update/modify your code in test_branch, Once you are done with the changes do following

5. git add -A ( to add files)

6. git status ( to check the status of changed files )

7. git commit -m ‘commit message’ (to commit the files in test_branch)

8. gitk (to view the changes of your files )

8. git checkout master ( to switch to the master branch )

9. git pull origin master ( Get the latest code from origin master )

9. Merge local branch i.e. ‘test_branch’ changes with latest master code by using the following command.
>> git merge test_branch

If you will get merge conflicts, then fix it and commit the code.

Now you are ready to push the code into the branch

10. Push your local change into dev review branch by using following command
>> git push origin master:://
Ex: git push origin master:review/laxma.reddy/brnach_for_test_review

Comments 0

Your email address will not be published. Required fields are marked *

log in

Become a part of our community!

reset password

Back to
log in