I have a master branch and a featureBranch.
Our companies default is to rebase the featureBranch to the master so that the featureBranch is uptodate with the master.
Then to push the featureBranch to the master
git push origin featureBranch:master
How can I achive this with Sourcetree?
When you push to a remote, SourceTree gives you the option to specify which local branch(es) to push, as well as which remote branch to push to.
Related
when i use git pull command I came with an error as below
You need to have an active & tracking branch to pull from, As of this moment, you don’t have one set up.
To confirm an active & track a branch:
git branch --set-upstream-to=origin/‹branch› main
More Information on git pull:
https://www.freecodecamp.org/news/git-pull-explained/amp/
It seems you are trying to pull from an unknown branch.
You can try pull from master branch
git pull origin master
Or you can pair your local master branch with remote master branch using
git branch --set-upstream-to=origin/master master
After setting upstream, normal "git pull" command will work. You don't have to specify branch name with "git pull".
Why i'm unable to create a branch on remote.I'm using this command git push --set-upstream origin mybranch
There is no error message on terminal. It asks for email and pass. But when I refresh github.com. There is no branch other than 'master'
The branch is there in github.Click on the branches link
It is because you are not pushing to the right remote branch. Try -
git push test-1 master
I searched this but unable to find my answer.
And I just want to know the non command line way to do this....
Or is there any other way to achieve this same ?
You can delete files (from a repo you own, like a fork)
But you cannot directly from the web interface delete commits.
For that you would need to clone, do an interactive rebase (dropping the commits you don't want) and git push --force.
Even a revert does not seem possible.
The OP adds:
Actually I have 3 branches one is master and rest two are patch-1 and patch-2 and I messed up with master branch before creating patch-1 and patch-2 branches so some useless commits are also cloned from master to patch-1 and patch-2 branch so please can you help me to delete those commits which are cloned from master?
No without cloning the repo though:
git clone /url/of/your/fork
cd yourfork
git remote add upstream /url/original/repo
git fetch upstream
git checkout -b patch-1 origin/patch-1
git checkout -b patch-2 origin/patch-2
Then replay your patches on top of upstream master:
git rebase --onto upstream/master master patch-1
git rebase --onto upstream/master master patch-2
Finally reset master to the upstream master branch:
git checkout master
git reset --hard upstream/master
And then push everything back to your fork:
git push --force --mirror
Essentially, I followed these steps: https://github.com/edx/edx-platform/wiki/How-to-Rebase-a-Pull-Request
The only difference is that I used get rebase onto master to sync master into my feature branch. This is my workflow:
git checkout master
git pull
git checkout <my branch>
git rebase onto master
git push -f origin <my branch>
However, when I now go into github to do a pull request, it is showing old commits that have already been merged.
I can't find the answer anywhere...
I created a local branch from my master branch on my local repo.
Now, I want to push my branch to bitbucket (my master branch is already syncing fine)
How can I do that? (I don't have EGit, I can't download it for some reason)
with Git Bash do :
git push origin "your-name-of-branch"
This command push your origin (local branch) into remote "your-name-of-branch". If "your-name-of-branch" doesn't exist, create it