English 中文(简体)
如何逐级改变地方名录到遥远而不采用克隆技术?
原标题:How to github commit changes from local directory to remote without cloning step by step?

I have a github repository and a local directory with changes without any .git directories in it. I want to commit my changes. I can clone github and then copy files there but this would change modification dates of the files which I don t want.

我做了些什么:

git init
git remote add origin https://...
git fetch origin
git add .
git status - shows all files as new
git diff origin/main - shows the correct changes I want to commit

我当时这样做了。

git commit -m  My first commit  

在我这个地方分支机构成为主人之后,地位不会再显示任何情况。

我知道,这可能是真正的基本内容,但我无法真正找到这样做的任何指南。

<><>UPDATE: 我已经找到了这方面一个简单而简单的工作方式。 在其他一些名录中,我确实:

git clone  https://...

然后复制我的真工作名录,并:

git add .
git status

And volia! 所有这些变化都是存在的。

根据我的理解,现在,用“git init”获得远距离添加、git fetch”。 我将最终建立一个空洞的地方存放处,并将首先致力于这项工作。 它将产生由2项承诺组成的“共同承诺”:1项是初步承诺,2项是实际承诺。 这会非常看似这种“初步”的。

问题回答

copy files there but this would change modification dates

http://strong>pax(1)。 类似于

$ pax -rw modfied.c working_tree/

将在不改动元数据的情况下复制文档。

很可能,由于你对遥远的存放处有 t,你们的当地传票不知道你想要做什么。 换言之,贵处没有目标。 可查阅http://www.git-scm.com/docs/git-branch/2.13.7“rel=“nofollow noreferer”>。 类似:

git branch -u origin main

Then try your git status/git push again. It should know what to compare to and push to now.

It sounds like you have a very old copy of Git, because your local default branch is called master whereas the GitHub default branch, and the default branch in modern Git, is main. However, all is not lost; just switch to main and merge:

git switch main
git merge master

现在推动Gite Hub:

git push origin main

但这将改变我不想改动的档案日期。

因此,Gite不是你想要使用的工具,因为:

  • 首先, 吉唐不尊重原始文件修改日期。 它对此不感兴趣。 相反,每当你检查一个分支时,在同一邦工作树中还没有出现的任何档案都会被打上新的记号——其修改日期变成now<>。 因此,如果你关心保存原始文件修改日期,你会重犯错误。

  • 但也许你指的是,你想要保存的是你所作的“变革”的。 确实,严酷。 你作出所有这些“变革”而没有受到Gite控制,因此,Gite没有对此负责,也不了解其中的任何内容。 页: 1 如果事件令对你很重要,那就是开始在当地工作树林内工作。 吉唐,在每一条ed子之后,为保持你作出“改变”的历史秩序而进行补充和投入。 但是,现在它太晚了;历史火车已经离开了该电台。





相关问题
Publishing partial git history

I would like to publish my git history to a public repository but would like to remove older commits. All the ways I have seen to do this alter the newer commit s SHA1s, which is not an option since I ...

Use the commit message in a CVS pre-commit hook

Is it possible to use the commit message in a pre-commit hook in CVS? The CVS server is running remotely, and I access it using pserver. Ideally, I want to allow the commit if the files pass the ...

Subversion Dreamhost Coda

I am a intermediate web developer, I am attempting to integrate subversion into my workflow. I have come to the understanding, that it is something important to learn, and can save me from rewrite ...

SQLite Transaction not committing

For an application we are developing we need to read n rows from a table and then selectively update those rows based on domain specific criteria. During this operation all other users of the ...

Can a script be automated after a commit on Perforce?

We use Perforce at work, and routinely keep software projects in the repository. In general creators follow the normal Perforce flow, BUT we also have a class of users, who doesn t have any need to ...