Google Certified Associate Cloud Engineer 2020

Sign Up Free or Log In to participate!

Updating files from git !

I have changed content of hello.js in previous lab and when I refreshed the content of directory using update.sh, hello.js reloaded with original file and I have lost my changes. So it refresh all the content from directory, though it refresh only missing directories or files ?

2 Answers

You’re right, but fortunately, there is a solution.

Git has a feature called stashing. Basically, you can make changes to your files. Before you download a copy of the new contents of the repository, git can stash these changes you’ve made, to bring them back after the download.

In Mattias’s update.sh script, he brilliantly added in this functionality, and git will stash any changes before downloading the full copy. To retrieve them, go to the gcp-cloud-engineer directory, and run the command git stash apply. This should bring back everything from the stash.

Rajashekar Yeddulapalli

Thanks Stephen, I will check stash option.

It might be better to fork the Github project. Then you can:

1. Clone the project from your fork.
2. Push changes to your fork.

You can read about forking here: https://help.github.com/en/github/getting-started-with-github/fork-a-repo

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?