我有一个服务器,那里有一些我不知道的配置,我只是git pull,它得到了github repo中的内容,然后重新启动它以便部署。
问题是,有一个提交不是我的最新提交,也不是我的服务器上。文件不在. gitignore中。我如何保证一个拉,拉一个提交?
我真的不知道该怎么修复,我在考虑重启一切:(
14:41][root@someserver] someserver_dir (master)$ git status
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: Gemfile
# modified: Gemfile.lock
# modified: config/assets.yml
# modified: config/database.yml
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# randomfiles
字符串
3条答案
按热度按时间7y4bm7vi1#
如果你总是希望你的服务器版本反映你的仓库中的一个提交,使用
git reset
而不是git pull
可能更好--这样你就不会调用合并功能,而是将所有的文件设置为你重置的提交中的文件。举例来说:字符串
i5desfxk2#
可以使用
git pull origin branch_name
。例如:如果我在GitHub上有一个生产分支,那么我会写
git pull origin production
,它会给予我所有最新的提交。只执行
git pull
有时并不能给予你生产分支的最新提交,即使你正在那个分支上工作并提交它。幕后工作
http://git-scm.com/docs/git-pull#_default_behaviour
Explanation and Examples
x33g5p2x3#
尝试清理本地仓库,然后运行git pull:
字符串