Date Published: February 5, 2025
Reset a Git repository on Acquia Cloud
Resetting a repository completely erases your code and all repository history. If you need this data, make a backup now before proceeding.
ADVANCED
Incorrect use of this page's content can cause damage to your environment.
When you reset your repository, you may also want to empty your databases. Before you reset the repository, you can accomplish this by using the following Drush command:
Clearing the repository¶
Use the following steps to clear your current repository. This procedure requires that you're signed into the Acquia Could UI and can execute command line tools on your local server.
Note
After completing this procedure, you may receive Git warnings about an untracked file, which is the Acquia-generated files
directory. You can add this directory to your .gitignore
file.
- Deploy the master branch on all environments in the Acquia Cloud Dashboard. For more information on how to manage code on Acquia Cloud see Code workflows with Acquia Cloud
- Clone the repo locally for safety. On your local server, run the following command:
-
git clone --mirror [repo_address]
where [repo_address]
is the URL of your code repository.
- Create a new, empty repository on your local computer. Navigate to a new directory on your local computer, and then run the following commands from the command line:
% mkdir reset
% cd reset
% git init
- In the reset directory, add a directory named
docroot
, which contains an empty file.
% mkdir docroot
% touch docroot/README.txt
- Send the empty repository to the remote server by adding and committing the changes to the folder.
% git add .
% git commit -m "Initial commit"
- Add the remote origin Git repository:
git remote add origin [repo_address]
where [repo_address]
is the URL of your code repository.
- Push the changes to the remote repository.
git push --mirror --force
The remote repository should now be cleared of its code.
Did not find what you were looking for?
If this content did not answer your questions, try searching or contacting our support team for further assistance.