Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

What would be the purpose of this command?

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
Community showcase
Posted in Bitbucket

How do you use the Bitbucket-Jira integration? How does it help your team?

Hey everyone, over the past year, we've added several new features on how you can use Bitbucket and Jira together. We'd love to know how you'll are using the integration and how it's helping your t...

139 views 0 2
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you