The standard solution for your problem is to move the string into a configuration file and add that file to .gitignore
. Also, put a renamed copy of the file into the repository together with explanation about how to use it.
The format of the configuration file and the way you use it depend on the language you are using.
For C
, C++
and similar languages it can be as simple as a .h
file that contains something along these lines:
/**
* This file contains various constants (paths, for example) that are specific
* to the computer where this code is compiled.
*
* Make a copy of this file as 'config.h' and change it to match your system.
*/
#ifndef __CONFIG_H__
#define __CONFIG_H__
/* The path to the OBJ file used by blah-blah-blah feature */
#define OBJ_PATH "D:/Software Projects/OpenGL/Raytracing-Project/dodgeColorTest.obj"
#endif
Name it config.h.dist
(or use another name that is more appropriate to your project and coding style) and add it to the repository.
Make a copy of it as config.h
and add config.h
to .gitignore
.
Put #include "config.h"
into the file from where you extracted the code above and replace the concrete file path with the symbol defined in config.h
:
#include "config.h"
MyMesh.loadMesh(OBJ_PATH);
Use the technique to extract from the code into config.h
all the values that may be different on the systems of your workmates. Don't forget to add them to config.h.dist
too, with a relevant description about their types and the values they may have.