Merging two branches on Github - github

I'm new to Github and I have a branch that I want to merge with the master. I couldn't merge it via git command line, its very complicated.
I tried to merge it on Github site following below documentation:
Merging a pull request on GitHub
But I got the following message:
There isn’t anything to compare!
Here's the project:
https://github.com/SumayahAlharbi/erecords
What does 4 commits behind master mean?
Update
Please check below pictures:
I thought I did the merging successfully but nothing changes!

What does 4 commits behind master mean?
It means that the master branch has 4 commits which are not present in your branch currently. You need to rebase your branch and then create a New Pull
Request which will be needed to be reviewed and finally approved so
that your branch can be merged with the master.
There isn’t anything to compare!
Check the difference between the master and your branch. Click the Compare icon in Git hub or run this
command from your local branch in Git Bash : git diff --name-only master_branch.

I just checked your repo. The changes of ExportFeature branch are already merged into the master branch, and then the merge is reverted. That's why now if you raise a pull request to merge ExportFeature into master, you would get There isn’t anything to compare!.
See the latest commits on ExportFeature which are already present in the master branch.
The reason you are seeing 4 commits behind master on ExportFeature branch is since the master branch has 4 more commits than the ExportFeature branch. If you see the total commits on ExportFeature branch, it's 7, whereas the total number of commits on the master branch is 11. If you need to do any more changes on the ExportFeature branch, you would need to get the latest changes from the master branch by running the command git pull origin master when your current branch is ExportFeature on your local git terminal.

Related

Issue when pull request on GitHub

Commit Merge branch dev from my-branch
2 pull requests from my-branch to dev and master branch
Hi everyone,
I have problem when pull request from my branch to dev and master branch. It was occured 1 commit is Merge branch dev into my branch - I hadn't pull request it yet. That's odd.
Base on first image, you can see the title is commit dev from my branch (So, It means I created a pull request). But in the commit, we can see a commit named "Merge branch dev into ...".
And I don't know how to check it, because it only has one Pull request to merge code (into dev from my-branch).
My process is :
Switch master (git checkout master)
Pull from master (git fetch -p and git pull)
Create new local branch from (git checkout -b my branch)
Push to GitHub (git push origin -u HEAD)
Pull request (first is into dev from my branch, second is into master from my branch)
The different with other my pull requests is this pull request have many conflicts I need to fix manually.
I'm not sure if I wrong at what step?
And I have last question, how we can block pull request from dev to another branch?
Thanks so much.
I just wonder why it has Merge branch dev, It makes code was wrong.
And could anyone tell me know how to block pull request from dev to another branch?

How to get rid of having *already merged* commits being ahead of origin branch

On my gihub forked repo, it is said that the master branch is 9 commits ahead of the parent repository's master branch.
When I click compare, it is shown that 0 files changed.
The reason why I have these commits:
8 commits were made to solve an issue, opened PR to the upstream repo, PR was successfully merged to the parent repo. While merging I chose the option to squash my 8 commits into 1 commit.
Then on my github forked repo page I had a message "your branch is 8 commits ahead, 3 commits behind"
I have synced my local forked repo with the upstream repo.
$ git remote add upstream https://github.com/[Original Owner Username]/[Original Repository].git
$ git fetch upstream
$ git checkout master
$ git merge upstream/master
$ git push
While merging there were no conflicts. And due to merging local/master with upstream/master 1 more commit was created.
I guessed that updating the local forked repo and pushing changes to the github repo would help to resolve the issue. But, apparently, no.
Why do I still have 8 commits ahead, if they were already merged into the parent repo? Is it because of squashing while merging PR?
How can I get rid of these meaningless commits being ahead?

Branch deploys with old commit

I have two branches in Github. Master and CoolFeature.
When i check CoolFeature in Github i see that it is even with Master.
When i deploy through Team City the Master branch somehow i get a commit from the Master branch that is five commits behind. I can see it in Team City by checking the SHA1. Is there some feature i have missed?
When i deploy the CoolFeature branch then the latest changes works cause CoolFeature deploys the latest commit.
Edit:
When i checkout the master branch i get this message:
> git checkout origin/master
Note: checking out 'origin/master'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b <new-branch-name>
HEAD is now at e86824af5...
The SHA1 hash refered e86824af5... IS the latest commit. And this is the one i want to be deployed. But TeamCity deploys a commit that is five commits behind this one. I can see it in the log comparing the SH1 hash ids.

Merging branches with Pycharm using Github repo

What is the correct way to merge two branches of a Github project with Pycharm?
Suppose there is a branch in a Github project called master and I clone the repo with Pycharm. After that, I create a new branch dev by using Pycharm. The new branch is then shown correctly on Github and some commits are made to the branch.
Now, I want to merge the changes from the dev branch to the master branch.
For ordinary git (not Github) projects, I would checkout to the local master in Pycharm, click on dev in the local branch and select the merge context menu. As a result, dev would be merged to master such that it can be safely deleted.Though, even after I merge the local master with the remote master branch, no changes are shown on Github and both branches still exist.
I also tried to close Pycharm, do a pull request on Github, merge the branches there and restart Pycharm. Unfortunately, Pycharm doesn't even recognize that the remote dev branch has been deleted.
My subpar solution has been as follows:
Pycharm: Merge local dev to local master, delete local dev, merge local
master with remote master
Github: Create PR, merge branches, delete dev
Pycharm: Delete remote dev
Now, if I rebase onto the remote master in Pycharm, I get the correct merged branch. Unfortunately though, using the compare context menu, Pycharm still shows that the remote master compared to the local master doesn't have the commits from dev. Although a rebase from the remote master contains all the commits from dev...
Sadly, there's also no Pycharm manual for merging branches with Github (for normal git there is). Any idea?
The solution is to manually push your branch merge as it seems that pycharm doesn't do this, but it thinks it has.
I've noticed the same issue and it seems that the merge is not pushed from the local copy. In a command shell I checkout the master branch of my project and it tells me that I am ahead of online repository, so to resolve this I issue the git push command and then when I check github it has been uploaded.
(tf36) E:\git\alpha-zero-theputernerd>git checkout master
Already on 'master'
A src/alpha_zero/env/env_inherit_from.py
Your branch is ahead of 'origin/master' by 3 commits.
(use "git push" to publish your local commits)
(tf36) E:\git\alpha-zero-theputernerd>git push
Total 0 (delta 0), reused 0 (delta 0)
To https://github.com/theputernerd/alpha-zero-theputernerd.git
bb60325..37c3c9d master -> master

How to merge master branch in local feature branch

In one of case I have created an branch and started to work on. I keep on commit & push changes in local branch but did not merge in master & neither pulled any changes from master.
Now I'm done with local branch changes. I followed derekgourlay tutorial & followed following steps to merge my project.
git fetch origin
git rebase −p origin/develop
First it game me number of conflict which was obvious but changes that I committed in my local branch those are not there after merge.
Am I missing anything. Any suggestion?
You can merge develop branch with your feature branch.
$ git checkout feature
$ git pull origin develop # pull (fetch + merge) develop branch into feature
$ git push origin HEAD # update remote/feature