小编mva*_*vaz的帖子

重绕远程git分支

可能重复:
如何将修改后的提交推送到远程git仓库?
撤消git推送

嗨,

我通过使用删除了我的主分支的一些提交

git reset --hard SHA_VALUE
Run Code Online (Sandbox Code Playgroud)

我有一个github上的远程版本的存储库,每当我发现git push错误消息时,我都应该合并远程存储库中包含的更改(我不想这样做).

所以我的问题是,git reset命令的远程等价物是什么?

谢谢

git version-control

6
推荐指数
2
解决办法
3121
查看次数

使用istream作为参数的命名构造函数的问题

我正在尝试为我的类Matrix创建一个命名构造函数,输入作为流,我可以从中读取初始化的值.

#include <istream>
// ...

class Matrix
{
public:
    Matrix(int);
    // some methods
    static Matrix *newFromStream(istream&);

private:
    int n;
    std::valarray< Cell > data;
};
Run Code Online (Sandbox Code Playgroud)

该方法应该或多或少地像这样实现

Matrix *Matrix::newFromStream(istream &ist) {

    // read first line and determine how many numbers there are
    string s;
    getline( ist, s );
    ...
    istringstream iss( s, istringstream::in);

    int n = 0, k = 0;
    while ( iss >> k)
        n++;
    Matrix *m = new Matrix( n );    

    // read some more values from ist and initialize …
Run Code Online (Sandbox Code Playgroud)

c++ stream named-constructor

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

标签 统计

c++ ×1

git ×1

named-constructor ×1

stream ×1

version-control ×1