Is there any way to clone a specific brach in git desktop? - github

I tried but its cloning whole repository. I wanted to clone only specific branch in that repository
Thanks in advance

You only can clone a whole repository except a branch, the code is:
git clone -b mybranch --single-branch git://sub.domain.com/repo.git
If you already have the repository cloned, you can refresh the branch you want, if you have forked the project you can refresh the specific branch you want. the code is:
git checkout 'branch if you want to change to refresh it'
git pull <URL of REPOSITORY> 'branch that you want to refresh it'
git commit -m "message"
git push upstream 'branch that you want to refresh it'

Related

How to make pull request?

I am new in git and in nodejs. My question is I build a project and uploaded it on github in main branch. But members are asking to to give pull request. How can I make a pull request please tell me full procedure with commands if possible thankyou.
I uploaded on git like this
Git init
Git add .
Git commit -m"initial commit"
Git git add origin main githublink(ssh)
Git push -u origin main
After this my project is uploaded successfully
Now how can I make a pull request
first you need to checkout from the main branch by git checkout
then you develop and code in that branch
next you commit and push that branch on github repo
git commit -m"initial commit"
git add origin <your_branch> githublink(ssh)
git push -u origin <your_branch>
finally you access the github page and your new branch. create a pull request into the main branch. then share that pr to your colleagues.
for example the last step:

Github: fork into new branch

I need to fork the branch from PrestaShop:develop into a different branch and not username:develop
How can this be done?
Fork = clone repository of another user on Github, and make GitHub know about it
1) Fork the repo as usual with the fork button
2) If you want to rename the branch
git branch -m old_branch_name new_branch_name
git push origin :old_branch_name
git push origin new_branch_name
If you want to rename not branch but the whole repository - see, How.
If you want to have both branches in one repository, it is not a GitHub feature named fork, it is branching: branch ..., or checkout -b:
git checkout -b new_branch old_branch
git push -u origin new_branch
In that case you should not cope with GitHub forks to create a new branch from yours existing one.

How to remove a commit on repository of GitHub from merge of other repository?

I accidentally merge pull a commit to other repository GitHub ( My local file is not change , this is still correct version). How to remove this version on GitHub? I mean that i revert (update url post ...) 2db249f .Please help me!!
git pull
git rebase -i HEAD~2
git reset --soft HEAD^
git push origin master

Unable to find branch in git repo

In the current directory. I had made a repository yesterday from this directory.
now:
git branch foo
After doing some changes in the file..
git add .
git commit -m "commit1"
git push.
I am unable to see the branch from my repo on github. While git branch does show this foo.
What you did is creating a local branch;
you will need alternatively to make it a remote branch:
git push <remote-name> <branch-name>
where <remote-name> is usually origin

How to fix github after a wrong push

My team-mate "accidentally" pushed a 2 commits to github breaking our branching model.
I want to revert my github repository as it was.
Here you go:
git clone url project
cd project
git reset HEAD^^ --hard
git push --force