简体   繁体   English

我只能在git中为一些远程仓库添加一些文件吗

[英]Can i add few files for some remote repo only in git

I have the git repo and i have two remote repos one is deafult and other backup 我有git repo,我有两个remote repos deafult ,一个是deafult ,另一个是backup

I push to other branch by 我推到其他分支

git push backup

Now i have folder called backupfiles which i don't want to push in deafult but i do want it to be avaiable in backup repo 现在我有一个名为backupfiles文件夹,我不想按deafult键,但是我确实希望它在backup回购中可用

is there any way 有什么办法吗

You can choose which refs (branches, tags etc) you push to or fetch from another repository, but the files committed in the history of a ref are non-negotiable (unless you change the history with eg git filter-branch ). 您可以选择要推送到其他存储库或从另一个存储库获取的引用(分支,标签等),但是引用历史记录中提交的文件是不可协商的(除非您使用git filter-branch更改了历史记录)。 You could create another branch where you commit the files in the backupfiles directory and push that branch to a subset of your remote repositories. 您可以创建另一个分支,在其中提交backupfiles目录中的文件,并将该分支推送到远程存储库的子集。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我可以将文件添加到本地Git存储库中,但不能将其推送到远程 - Can I add a file to my local Git repo but not push it to remote GIT:仅将远程存储库中的一些文件添加为子模块 - GIT: add only some files from remote repository as submodule Git:添加远程仓库,仅下载差异文件? - Git: add remote repo and only download diffs? 为什么我不能在现有存储库中进行“ git clone repo”,而不能在现有存储库的子文件夹中进行“ git remote add origin repo”? - Why can I do “git clone repo” inside an existing repo but not “git remote add origin repo” inside subfolder in an existing repo? 如何将大文件添加到 Git 存储库? - How can I add large files to a Git repo? 我可以将一个本地 git 存储库与两个远程存储库一起使用吗? - Can I use one local git repo with two remote repo? 仅使用 git-crypt unlock 解密某些文件而不是整个 repo - Descrypt only some files with git-crypt unlock and not the entire repo Git将远程仓库添加为站点 - Git add remote repo as a site 是否可以跟踪在远程但不在本地目录中创建的文件或将其添加到Git存储库中? - Can I track or add to a Git repo a file that's created on a remote but not in local directory? 列出我已推送到远程Git存储库的所有文件 - List out all the files that I have pushed to the remote Git repo
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM