Git拉不拉一切 [英] Git pull not pulling everything

查看:82
本文介绍了Git拉不拉一切的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一台服务器,其中有一些配置,我不能正确知道我在哪里进行git pull,并获取github回购站中的内容,然后重新启动以便部署。

I have a server where there's some config that I don't properly know where i just git pull and it gets what is in a github repo, then restart it in order to deploy.

事情是,有一个不属于我的最新的提交,它并不在我的服务器上。这些文件不在.gitignore中。我如何确保拉,拉一个提交?

The thing is, there's a commit which isn't my latest, that isn't really on my server. The files aren't in .gitignore. How do I assure that a pull, pulled a commit?

我真的不知道如何解决它,我正在考虑重新启动一切:(

I really don't know how to fix it, I'm thinking about restarting everything :(

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


推荐答案

版本来反映您的回购提交,它可能更好地使用 git reset 而不是 git pull - 那样你从来没有invo ke合并功能,而是将所有文件设置为您重置为的提交中的内容。例如:

If you always want your server version to reflect a commit from your repo, it's probably better to use git reset instead of git pull - that way you never invoke merge functionality, but instead set all of the files to exactly what they are in the commit you reset to. For example:

git fetch origin master
git reset --hard FETCH_HEAD

这篇关于Git拉不拉一切的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆