


Or delete your local repository and clone it again. Now we need to commit all the changes, unfortunately using force push: $ git` push origin -force -allĪfter all the changes have been made, everyone else who has worked with this repository needs to rebase. If there are other files that need to be removed, run this command for each of them. 'git rm -f -cached -ignore-unmatch folder_to_remove/' \ If you want to remove the directory, you must add the -f switch to git rm: $ git` filter-branch -force -index-filter \ Ref 'refs/remotes/origin/master' was rewritten Sound familiar? I hope not.Īfter making sure we have the latest version and that there are no local changes, we can delete the file using git-filter-branch: $ git` filter-branch -force -index-filter \ The project is in active development and a test database is being used, but out of habit, the password is the same as the one you use to log in to the system or anywhere else. secret file in the repository, which stores the password for the database. Git-filter-branch the utility is part of git and does not require additional installation. This article describes how to use the BFG Repo-Cleaner and git-filter-branch to completely remove a file from a git repository. There is no way to trace if anyone has seen or downloaded these files.įortunately, there are tools that allow you to remove a file from a git repository completely. Once a file with private data is in the repository, all data in it can be considered compromised, and immediate action must be taken (changing passwords, etc.). Of course, you can use git rm to remove the file, but the file will still be in the history.

One day, when working with your git-based project, you may accidentally save your personal logins, passwords or SSH keys to the repository. (But if you do have any funny/scary stories, please share in the comments). Be aware of that - you have been warned (commands are not working). Refresh the HCP cockpit once again will show that version ‘v1.5’ has been successfully removed from the versions list.Caution: please use the below knowledge with caution - all the tools described below cannot be used with blind copy-pasting. Where ‘v1.5’ represents the name of your tag, the following deletion confirmation will be displayed: In order to remove a ‘tagged’ development branch /version from your repo you can use the following git command: Refreshing the HCP Commits in the History section will show that the master branch commit(s) have been removed and updated. + h12b6… dfg88f35a1 master -> master (forced update) Remote: Processing changes: refs: 1, done If you need to move the HEAD down two positions (deleting the last two commits) from the top of the list you can use:Ī confirmation message will be displayed notifying you that the force update has been successfully pushed to the master branch. This will move the head down one place from the top of the list to the ‘Initial empty repository’ commit. Step 3 – Delete the latest commit ‘version: 0.1’: In order to remove a master branch commit from HCP you first need to reset the HEAD to point to the version you would like to revert to.Ī list of commits will be displayed as follows: Attempting to remove branch commits with tools such as Source Tree didn’t seem work for me however I was able to remove commits from both branches using git bash/command.

The following guide provides a quick work around for deleting commits off your HCP git repositories.Īfter following the robust HCP git and feature branch strategy by DJ Adams, I discovered that the HCP cockpit restricts users from deleting both master and development branches/ versions. When developing on HCP either from the WebIDE or local environments the ability to delete branch commits can become quite a hassle.
