相关疑难解决方法(0)

'git remote update','git fetch'和'git pull'有什么区别?

我现在开始和Git玩了,我有点困惑.对我来说,看起来有很多选择可以做同样的事情.我现在的问题是以下命令之间的区别是什么:

  • git远程更新
  • git fetch
  • git pull

还有哪一个更适用于更新远程分支的本地副本?

git

57
推荐指数
1
解决办法
3万
查看次数

如何从远程git存储库一次提取一个提交?

我正在尝试建立一个git存储库的darcs镜像.我有一些工作正常,但有一个重大问题:如果我将一大堆提交推送到git repo,那些提交将合并到一个darcs补丁集中.我真的想确保每个git commit都设置为单个darcs补丁集.我敢打赌这可能是通过某种方式git fetch跟踪审查远程分支的本地副本,但我的git fu不能胜任这项工作.

这是我现在使用的(ksh)代码,或多或少:

git pull -v # pulls all the commits from remote --- bad!

# gets information about only the last commit pulled -- bad!
author="$(git log HEAD^..HEAD --pretty=format:"%an <%ae>")"
logfile=$(mktemp)
git log HEAD^..HEAD --pretty=format:"%s%n%b%n" > $logfile

# add all new files to darcs and record a patchset. this part is OK
darcs add -q --umask=0002 -r .
darcs record -a -A "$author" --logfile="$logfile"
darcs push -a
rm -f $logfile
Run Code Online (Sandbox Code Playgroud)

我的想法是

  1. 尝试git fetch …

git mirroring darcs

9
推荐指数
1
解决办法
7968
查看次数

在Git中执行“拉动”操作之前是否需要“远程更新”

假设我已经从c:\中完成了以下操作,从远程来源获取最新代码的正确方法是什么?

# Create repo...
mkdir Test
cd Test
git init
...create files
git add .
git commit -a -m "Init Commit"

# Clone repo...
cd ..
git clone Test TestClone

# Edit original
cd Test
...edit files
git commit -a -m "Init Edit"

# Go back to Clone
cd ..\TestClone

# Get latest code
# Now what??? pull or update then pull
Run Code Online (Sandbox Code Playgroud)

git git-pull git-remote

5
推荐指数
2
解决办法
2312
查看次数

标签 统计

git ×3

darcs ×1

git-pull ×1

git-remote ×1

mirroring ×1