Git远程仓库与本地不匹配(即使推后) [英] Git remote repository doesn't match local (even after push)

查看:235
本文介绍了Git远程仓库与本地不匹配(即使推后)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即使在推送之后,我的git存储库和本地分支也是不同的。连续推送只返回一切都是最新的。真奇怪的是我使用webpack捆绑文件,而webpack也没有感觉到本地文件差异。它将这些文件捆绑在存储库中查看(这导致像onClick函数不会触发或根本不被注意的问题)。有人知道为什么会发生这种情况吗?



以下是代码:



本地文件:

  import从'react'反应; 

$ b $ class OpenDisplay继承React.Component {
构造函数(道具){
super(道具)
this.onClickHandler = this.onClickHandler.bind(这个)
}

onClickHandler(){
console.log(heyyy)
}

render(){
return(
< div id =opening-display>
< div id =options>
< a href ='#'className =row id =webpages-optiononClick = {this.onClickHandler}>
< div className =option col text-center btn-lg>
网页
< / div>
< / a>
< a href ='#'className =rowid =codepens-option>
< div className =option col text -center btn-lg>
Codepens
< / div>
< / A>
< / div>
< / div>

}
}

导出默认值OpeningDisplay;

远程git文件:

  import从'react'反应; 

$ b $ class OpenDisplay extends React.Component {
render(){
return(
< div id =opening-display>
< div id =options>
< a href ='#'className =rowid =webpages-option>
< div className =option col text-center btn-lg>
网页
< / div>
< / a>
< a href ='#'className =row id =codepens-option>

Codepens
< / div>
< / a>
< / div>
< / div>

}
}

导出默认值OpeningDisplay;

进一步信息:
当我对文件中没有的部分进行更改时正在改变:

  onClickHandler(){
console.log(heyyy)
}

到:

  onClickHandler(){
console.log(heyyyyyy)
}

并进行添加和提交,提交被跟踪。而当我推动这些变化时,它不会返回一切都是最新的,所以我相信这些变化正在以某种方式被追踪到......

找到了(愚蠢的)答案。我移动了文件,但它仍然在我的文本编辑器中打开,所以当我保存它时,将它保存在旧位置。所以我引用的文件保持不变。愚蠢的错误!

My git repository and local branch are different even after push. Consecutive pushes just returns "Everything up-to-date". The really weird thing is that I'm using webpack to bundle the files and webpack doesn't sense the local file differences either. It bundles the files as they look in the repository (which is causeing problems like the onClick function not firing or being noticed at all). Does anybody know why this would happen?

Here is the code:

local file:

import React from 'react';


class OpeningDisplay extends React.Component {
    constructor(props) {
        super(props)
        this.onClickHandler = this.onClickHandler.bind(this)
    }

    onClickHandler(){
        console.log("heyyy")
    }

    render() {
        return (
            <div id="opening-display">
                <div id="options">
                    <a href='#' className="row" id="webpages-option" onClick={this.onClickHandler}>
                        <div className="option col text-center btn-lg">
                            Webpages
                        </div>
                    </a>
                    <a href='#' className="row" id="codepens-option">
                        <div className="option col text-center btn-lg">
                            Codepens
                        </div>
                    </a>
                </div>
            </div>
        )
    }
}

export default OpeningDisplay;

remote git file:

import React from 'react';


class OpeningDisplay extends React.Component {
    render() {
        return (
            <div id="opening-display">
                <div id="options">
                    <a href='#' className="row" id="webpages-option">
                        <div className="option col text-center btn-lg">
                            Webpages
                        </div>
                    </a>
                    <a href='#' className="row" id="codepens-option">
                        <div className="option col text-center btn-lg">
                            Codepens
                        </div>
                    </a>
                </div>
            </div>
        )
    }
}

export default OpeningDisplay;

futher info: when I make a change to the parts of the file that are not being pushed remotely, like changing:

onClickHandler(){
        console.log("heyyy")
}

to:

onClickHandler(){
        console.log("heyyyyyy")
}

and make an add and commit, the commit is tracked. And when I push the changes it doesn't return "Everything up-to-date" so I believe changes are being tracked in some fashion...

解决方案

Found the (dumb) answer. I moved the file, but it was still open in my text editor, so when I saved it, saved it in the old location. So the file I'm referencing has remained unchanged. Dumb mistake!

这篇关于Git远程仓库与本地不匹配(即使推后)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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