There are cases where you want to keep some files in your workspace that shouldn’t be handled by HighFlux. This means that those files won’t be automatically pushed to the remote repository and be visible to all of your team, and also that they won’t be included in your WIP when you merge it or send it out for review.
Common scenarios include:
- Testing: Copying a file (or few) to the project directory to be used for developer testing.
- Secrets: A file containing credentials or passwords that you keep local and do not want to push to the repo.
- Configuration changes: Changing a source file flag so that your app will run differently on your machine. Things like hard-coded debug levels, password for local-db access, etc…
All of the above scenarios are considered bad practice. Each one of them has a well-known way to keep this information without changing the code. Solutions vary from automated tests with testing assets, keeping files off the source project, using environment variables, feature flags and more.
However, in reality, many projects do use the above “tactics” to move quickly.
HighFlux can mark certain files as “hidden” meaning that HighFlux will not push them to the shared code repository, hence these files or changes won’t be visible to anyone else but you.
Hiding files using the CLI
HighFlux provides support for these scenarios, currently only from the CLI.
To “hide” a file from HighFlux, you add it to your hidden files list:
hf hide <filename|directory>
You can “un-hide” a file using:
hf hide clear <filename|directory>
And list all of your hidden files:
hf hide list
Once a file is hidden it will not be touched by HighFlux, and stay on your disk when you switch between WIPs.
Hide by naming convention
In addition, HighFlux hides some files by naming convention. Every file that begins with the string
_hide_ is automatically set as hidden.
Let’s see how to use hidden files for the scenarios listed above:
Let’s say we want to have a big
video.mp4 file that is the input of a test program we’ve written to test part of our code manually.
Just drop the file in your root directory and specify:
hf hide video.mp4
This will make sure this file won’t be added to your WIP, and won’t be added to the remote repository.
Even easier, you can just rename it to
Note that when you switch WIPs, the file will remain on your disk, hidden.
An Android project has a file called
Log.java that contains a line specifying the logging level of the app like so:
public static final int LOG_LEVEL = 2;
Our developer wants to change this to be
LOG_LEVEL = 5, but for this change to not be included in the WIP that will be merged into trunk, and also to have this change be active in all WIPs he’s working on.
She could mark the file to be hidden:
hf hide Log.java
And make the change. Keep in mind that any other changes she will make to this file won’t go into the repository as well. This is easy to forget and thus we recommend to only temporarily hide files that are already existing in the repository. To help you with this, merging a WIP will give a warning if there are hidden changes.
Hiding entire new files that you own is intuitive. However, hiding changes within source files is tricky. Remember that HighFlux currently allows you to mark an entire file as hidden (but not part of files), which means that all changes you make to the files are also going to be hidden. (not committed to git or pushed to GitHub)