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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx': " password
echo ""
cd repo-in-branchB
echo “pull from branchB"
git pull https://$username:$password@xxxxxxxxxx/myrepo.git heads/branchB
echo “pull from parent branchA"
git pull https://$username:$password@xxxxxxxxxx/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.







[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux