[英]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.