Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

What would be the purpose of this command?

Hasan Nakib
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 21, 2021

Hi all, hopefully you can help me out with this question.

 

Context:

I have created a deployment pipeline which uses the ssh-run pipe to go into a server and run a few deployment scripts located on the server. The purpose of the deployment scripts is to pull changes from the Bitbucket repository into the server repository.

 

The staging deployment script:

cd /home/user/staging.site.co.uk/site-live/
git fetch origin
git reset HEAD origin/staging
git pull origin staging

 

The live deployment script:

cd /home/user/public_html/
git fetch origin
git reset HEAD origin/master
git pull origin master

 

Issues:

I have not created these deployment scripts so I am a bit unsure of the commands. My first issue is the use of the 'git reset HEAD' in both of the deployment scripts. As I understand it this command resets the index but not the actual working tree. What would be the purpose of this command in the deployment script.

My second issue is the git fetch and the git pull command. Is the git fetch redundant in this script.

Thanks.

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events