[英]How to commit files from a local folder named differently in the remote folder?
Firefox有一个配置文件文件夹 (它具有随机名称,如r2hy5dsu.default
)。
如果安装了Greasemonkey ,则会在该文件夹中创建一个名为gm_scripts
文件夹。
配置文件文件夹包含许多其他文件和文件夹,但是对我而言,目前唯一重要的是gm_scripts
。
所以,我想创建一个名为库reponameX
(不同r2hy5dsu.default
),其中包含一个名为文件夹dirY
(不同gm_scripts
)持有后者的内容,但我不知道这甚至有可能。
LOCAL GITHUB
r2hy5dsu.default <--> reponameX
+ gm_scripts <--> + dirY
+ + ... (a lot of other things) <--> + + (I want to sync everything here)
+ ... (a lot of other things) <--> + (I don't want to sync it at all)
我的问题是: 可能吗? 如果是这样,我该怎么做?
到目前为止,我发现的所有内容都是如何创建一个与本地文件夹不同名称的存储库,但第二部分什么也没有。
这样,它将帮助我轻松地发布和更新自己开发和测试的所有脚本,而不必复制到其他地方进行提交。
长期来看,最干净的方法是直接构建边带分支,这根本不涉及您当前的结帐:
#!/bin/sh
# Using only a temporary index file,
# Without touching the current checkout or using a worktree at all,
# Commit a hand-rolled commit to an arbitrary branch
$srctree=`git write-tree` # current status, `somecommit` elsewise
export GIT_INDEX_FILE=`mktemp -t`
git read-tree $srctree # load up the nonce index
git read-tree --prefix=dirY/ :gm-script # load `dirY/` from indexed `gm-script`
git rm --cached gm-script # remove indexed `gm-script`
tip=`git rev-parse -q for-github -- 2>&-` # commit to the tip of `for-github`
git update-ref refs/heads/for-github \
$( git commit-tree ${tip:+-p $tip} \
-m handroll `git write-tree`
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.