in Education by
I create a new branch in Git: git branch my_branch push it: git push origin my_branch Now say someone made some changes on the server and I want to pull from origin/my_branch. I do: git pull But I get: You asked me to pull without telling me which branch you want to merge with, and 'branch.my_branch.merge' in your configuration file does not tell me, either. Please specify which branch you want to use on the command line and try again (e.g. 'git pull '). See git-pull(1) for details. If you often merge with the same branch, you may want to use something like the following in your configuration file: [branch "my_branch"] remote = merge = [remote ""] url = fetch = See git-config(1) for details. I learned that I can make it work with: git branch --set-upstream my_branch origin/my_branch But why do I need to do this for every branch I create? Isn't it obvious that if I push my_branch into origin/my_branch, then I would want to pull origin/my_branch into my_branch? How can I make this the default behavior? Select the correct answer from above options

1 Answer

0 votes
by
 
Best answer
As per git version, 1.8.0 follow this command git branch --set-upstream-to origin/my_branch Or you can use git branch -u origin/my_branch From official announcement of v 1.8.0 * It was tempting to say "git branch --set-upstream origin/master", but that tells Git to arrange the local branch "origin/master" to integrate with the currently checked out branch, which is highly unlikely what the user meant. The option is deprecated; use the new "--set-upstream-to" (with a short-and-sweet "-u") option instead. For more information please go through the following tutorial to get more info about git:

Related questions

0 votes
    I don't want to rename a remote branch, as described in the Rename master branch for both local and remote ... and remote branch name Select the correct answer from above options...
asked Jan 30, 2022 in Education by JackTerrance
0 votes
    I cloned a Git repository, which contains about five branches. However, when I do git branch I only see one of ... staging * etc... Select the correct answer from above options...
asked Feb 4, 2022 in Education by JackTerrance
0 votes
    I created a local branch that I want to 'push' upstream. There is a similar question here on Stack ... the upstream repository? Select the correct answer from above options...
asked Feb 2, 2022 in Education by JackTerrance
0 votes
    I want to merge two branches that have been separated for a while and wanted to know which files have been modified ... I missed... Select the correct answer from above options...
asked Feb 3, 2022 in Education by JackTerrance
0 votes
    How do you delete untracked local files from your current working tree? Select the correct answer from above options...
asked Jan 30, 2022 in Education by JackTerrance
0 votes
    I want to take all the changes I made in the staging to my working directory. What command should I use to perform this ... B. git reset HEAD C. git reset TAIL D. git change...
asked Dec 23, 2022 in Technology by JackTerrance
0 votes
    I started some work on a new feature and after coding for a bit, I decided this feature should be on its ... on the new feature. Select the correct answer from above options...
asked Feb 2, 2022 in Education by JackTerrance
0 votes
    I staged a few changes to be committed; how can I see the diff of all files which are staged for the next ... an alias for, right? Select the correct answer from above options...
asked Feb 8, 2022 in Education by JackTerrance
0 votes
    I staged a few changes to be committed; how can I see the diff of all files which are staged for the next ... an alias for, right? Select the correct answer from above options...
asked Feb 5, 2022 in Education by JackTerrance
0 votes
    I would prefer to write my commit messages in Vim, but it is opening them in Emacs. How do I configure Git ... for a single project. Select the correct answer from above options...
asked Feb 2, 2022 in Education by JackTerrance
0 votes
    How do I discard changes in my working copy that are not in the index? Select the correct answer from above options...
asked Jan 30, 2022 in Education by JackTerrance
0 votes
    How do I revert from my current state to a snapshot made on a certain commit? If I do git log, then I get ... , i.e. commit 0d1d7fc? Select the correct answer from above options...
asked Jan 30, 2022 in Education by JackTerrance
0 votes
    What is the command to view all the commits made by a specific person (Jim)? A. git log – who=”Jim” ... Jim” C. git log – “Jim” D. git log...
asked Dec 23, 2022 in Technology by JackTerrance
0 votes
    What does the command git reset –hard HEAD ~3 do? A. Merges the last 3 commits to the master B. Discards ... nothing D. Resets the head to 3 commits before the current commit...
asked Dec 23, 2022 in Technology by JackTerrance
0 votes
    I've been wondering whether there is a good "git export" solution that creates a copy of a tree without the . ... tree into the index. Select the correct answer from above options...
asked Feb 2, 2022 in Education by JackTerrance
...