Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I commit in my branch before pull request is approved?

I am working on a branch of a project, say A. I create a pull request for the branch to be merged in master. Can I commit on my local repository before the pull request is approved.

On this branch I work, I commit and push.

like image 319
deepdark Avatar asked Jul 24 '19 07:07

deepdark


People also ask

Can we commit before pull?

If you have uncommitted changes, the merge part of the git pull command will fail and your local branch will be untouched. Thus, you should always commit your changes in a branch before pulling new commits from a remote repository.

Can I commit in my branch after pull request is approved?

No, commits will only be added to the branch where they are committed.

What happens if pull request is not approved?

Once you decline a pull request, you'll have to open a new pull request request to review code for the same branch. Declining a pull request has no impact on the source or destination branches of the pull request.

Can you push before pulling Git?

It's important to fetch and pull before you push. Fetching checks if there are any remote commits that you should incorporate into your local changes. If you see any, pull first to prevent any upstream merge conflicts.


2 Answers

An open pull request will accept new commits until it is eventually merged. So yes, you can still work on your local branch, and even push other commits to the same branch, they will then be added to the existing pull request. (You might need to refresh the page displaying the pull request if you have it already open in your browser, though)

Of course, once the PR has been merged, new commits on the branch will require a new PR to be merged into your receiving branch.

like image 100
Romain Valeri Avatar answered Sep 22 '22 13:09

Romain Valeri


On Your local machine You can do what ever You want.

But If someone will approve Your PR and merge it and You will try to push Your local commit it will be not possible.

When PR will be not approved/merged You can update it with Your local commit.

When Your PR will be not merged but approved usually when You will push new changes approve will be removed in case of new changes and required review.

like image 21
Esperanz0 Avatar answered Sep 20 '22 13:09

Esperanz0