LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Git from 2 repository with different gitignore (https://www.linuxquestions.org/questions/linux-newbie-8/git-from-2-repository-with-different-gitignore-4175532062/)

ytyyutianyun 01-25-2015 02:46 AM

Git from 2 repository with different gitignore
 
I pull a repository from a person and I want to push to my own repository because something change and I want to use different gitignore file. How can I do it? Thanks, and I want to use github and bitbucket both. Then is it possible. Thanks.

btmiller 01-25-2015 12:32 PM

It's definitely possible - you'll just have to set up two different remotes: one for gitlab and one for bitbucket. However, having two different .gitignore files is going to be somewhat tricky. I've never found a good way to do that. The best way might be to create two different branches in your clone (one with bitbucket as the origin and one with GitHub). These two branches can have different .gitignore files. The problem will be making sure changes to the .gitignore files are not overwritten when merging between the two branches. However, you can always revert any changes to .gitignore after merging.

There may be an easier way to do this, but if so I have yet to find it. Why do you need two different .gitignores? I presume you want to keep some files out of one or the other remote, but for what purpose?

ytyyutianyun 01-25-2015 07:43 PM

Quote:

Originally Posted by btmiller (Post 5306540)
It's definitely possible -.....?

Acutally, I use one person's emacs configuration and of course I add some plugins for my own. In his configuration, there are many files ignored. But I just want to push all things to my own repositary. And I am afraid when I pull from his configuration when he updated, it might overwrite the .gitignore. That is the reason.

pan64 01-26-2015 01:55 AM

I have never tried, but probably you can put .gitignore itself into .gitignore and you will have your own private copy. Other solution can be to use symbolic link instead of file, pointing outside of the repo.


All times are GMT -5. The time now is 11:08 AM.