git/list[1] front-page[2] threads[3] people[4] search[5] about
 

bash script to pull in branch B the changes from parent branch A

From
LPLaetitia Pfaender <laetitia.pfaender@icloud.com>
Date
Nov 21, 2017, 16:19 UTC
Message-ID
<BEFA6451-9A9A-4B44-B067-727136AD39EF@icloud.com>
Hi,
I have a bash script to pull in branch B the changes from parent branch A that does the following:

cd repo-in-branchB git branch --set-upstream-to=origin/branchB git pull git branch --set-upstream-to=origin/branchA git pull git branch --set-upstream-to=origin/branchB

It does exactly what I want but, as I have many children branches B to update, I would like to prompt my username and password only once and then makes the script use them in all following git requests. I came to the conclusion that I needed to update my script as follow:

read -p "Username for 'https://github.com': " username read -s -p "Password for 'https://$username@github.com': " password echo "" cd repo-in-branchB echo “pull from branchB" git pull https://$username:$password@github.com/myrepo.git heads/branchB echo “pull from parent branchA" git pull https://$username:$password@github.com/myrepo.git heads/branchA

I have never used this kind of URLs, so just to make sure, are these 2 versions conceptually equivalent? Will they do the exact same thing?
Best regards
Laetitia
PS: I’m open to suggestions but note that I don’t want to rebase, neither can I configure my username and password in a permanent way on this server.
Next: Paul Smith
Message 1 of 2 in “bash script to pull in branch B the changes from parent branch A”
  1. Laetitia PfaenderNov 21, 2017
  2. Paul SmithNov 21, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.