I am currently trying to setup a Xilinx Vivado project on git. Problem is there are tons of annoying files that Vivado uses that I dont want to see in a file dif. I want to be able to clone the project elsewhere and have it just work. So I don't just want to track the source files, but I only want to see source files in a file diff. How can this be done?
3 Answers
Add a file called .gitignore
to your project. This file contains a list of files & directories to ignore. For example, to ignore all the files in the path/to/images directory in your code add the line
/path/to/images
to the .gitignore
file. To ignore the file images/awesome_photo1.jpg just add the line
/images/awesome_photo1.jpg
If you have already added these files to your repository, you can remove them without deleting them with the command
git rm --cached file_to_ignore

- 9,106
- 19
- 57
- 93
-
Thanks for your answer. So I feel like this could be annoying to do and I wont know if my IDE will start creating random files and then Ill have to keep making changes to the gitignore file – Brian Crafton Jan 10 '16 at 23:20
-
If you look on github, there are `.gitignore` files for most IDEs. https://github.com/github/gitignore – wogsland Jan 10 '16 at 23:21
So I don't just want to track the source files, but I only want to see source files in a file diff.
I understand it that you want to still track those Vivado files, so they are still added to the repository and changes in there are kept etc., but don’t want to see changes in those files when looking at a diff.
In general, this is not possible since Git doesn’t know what kind a certain file is, if it’s relevant to you or not. Every file is treated the same by Git, so you will see changes in all file types. Furthermore, very often, even if it’s not a source file, additional files may be required by the system to run properly even if the file is not a real source file. And in that case, you want to make sure that changes in there don’t break either, so you do want to look at those diffs eventually as well.
You cannot restrict the kinds of files Git will show you in a diff, but you can tell Git to only show you a diff for a certain file path. For example, if you have all your source files in a directory src
, then you can tell Git to only show you the diffs for files in that folder:
git diff -- src/
Other than that, there is no way to turn off diffs for some files when asking Git for diffs. At least not if you still want to track those files and adding them to your .gitignore
is not an option.
Since you
You should start with your source files (*.vhd?, *.v, *.sdc) and the vivado project file.
Git is able to ignore comlete subfolders e.g. temp folders or generated IP core folders.
- Add all source files and the project file to your local git repository and
- commit them.
- Clone it into a second temporary folder and
- open the Vivado project.
If it opens and all files are there, it's ok. Otherwise:
- add the missing file(s).
- Commit it and
- pull it into the temp git.
- If more files are missing, do it again => goto 5.

- 15,573
- 13
- 70
- 139