我有一个服务器,其中有一些配置,我不知道我只是git pull,它获取github仓库中的内容,然后重新启动它以便部署.
问题是,有一个不是我最新的提交,实际上并不在我的服务器上.这些文件不在.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
Run Code Online (Sandbox Code Playgroud)
Amb*_*ber 88
如果你总是希望你的服务器版本反映你的repo的提交,那么最好使用git reset
而不是git pull
- 这样你永远不会调用合并功能,而是将所有文件设置为你重置的提交中的文件.例如:
git fetch origin master
git reset --hard FETCH_HEAD
Run Code Online (Sandbox Code Playgroud)
inv*_*ffi 14
您可以使用git pull origin branch_name
。
例如:如果我在 GitHub 上有一个生产分支,那么我将编写git pull origin production
它将提供所有最新提交的内容。
仅有时执行git pull
不会为您提供生产分支的最新提交,即使您正在该分支上工作并提交它。
幕后工作
http://git-scm.com/docs/git-pull#_default_behaviour
归档时间: |
|
查看次数: |
50655 次 |
最近记录: |