如何将本地副本上的所有文件恢复到某个提交?

commit 4a155e5b3b4548f5f8139b5210b9bb477fa549de
Author: John Doe <Doe.John.10@gmail.com>
Date:   Thu Jul 21 20:51:38 2011 -0500

这是我想要恢复到的提交。任何帮助都是救命稻草!

我正在写一个应用程序,如果用户在打电话时正在看应用程序,我需要改变视图。

我实现了以下方法:

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    NSLog(@"viewWillAppear:");
    _sv.frame = CGRectMake(0.0, 0.0, 320.0, self.view.bounds.size.height);
}

但当应用程序返回前台时,它没有被调用。

我知道我可以实现:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(statusBarFrameChanged:) name:UIApplicationDidChangeStatusBarFrameNotification object:nil];

但我不想这么做我更愿意把我所有的布局信息放在viewWillAppear:方法中,并让它处理所有可能的场景。

我甚至尝试调用viewWillAppear: from applicationWillEnterForeground:,但我似乎无法确定在那一点上哪个是当前视图控制器。

有人知道正确的处理方法吗?我肯定我错过了一个显而易见的解决方案。

我找到了各种关于如何恢复SVN提交的示例,例如

svn merge -r [current_version]:[previous_version] [repository_url]

or

svn merge -c -[R] .

但这两种方法似乎都不管用。我尝试了这些命令,并检查了手动更改的文件。

如何恢复修订号为1944的提交?我如何检查恢复已经完成(没有在实际文件中查看已恢复的更改)?

我如何在PostgreSQL 8.3查询中声明一个变量?

在MS SQL Server我可以这样做:

DECLARE @myvar INT
SET @myvar = 5

SELECT *
FROM somewhere
WHERE something = @myvar

我如何在PostgreSQL做同样的事情?根据文档,变量被简单地声明为“name type;”,但这给了我一个语法错误:

myvar INTEGER;

谁能给我一个正确语法的例子吗?

I was working with a friend on a project, and he edited a bunch of files that shouldn't have been edited. Somehow I merged his work into mine, either when I pulled it, or when I tried to just pick the specific files out that I wanted. I've been looking and playing for a long time, trying to figure out how to remove the commits that contain the edits to those files, it seems to be a toss up between revert and rebase, and there are no straightforward examples, and the docs assume I know more than I do.

下面是这个问题的简化版本:

给定下面的场景,我如何删除提交2?

$ mkdir git_revert_test && cd git_revert_test

$ git init
Initialized empty Git repository in /Users/josh/deleteme/git_revert_test/.git/

$ echo "line 1" > myfile

$ git add -A

$ git commit -m "commit 1"
[master (root-commit) 8230fa3] commit 1
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 myfile

$ echo "line 2" >> myfile

$ git commit -am "commit 2"
[master 342f9bb] commit 2
 1 files changed, 1 insertions(+), 0 deletions(-)

$ echo "line 3" >> myfile

$ git commit -am "commit 3"
[master 1bcb872] commit 3
 1 files changed, 1 insertions(+), 0 deletions(-)

预期的结果是

$ cat myfile
line 1
line 3

以下是我一直试图恢复的一个例子

$ git revert 342f9bb
Automatic revert failed.  After resolving the conflicts,
mark the corrected paths with 'git add <paths>' or 'git rm <paths>'
and commit the result.

如何在我的Linux服务器上跟踪MySQL查询?

例如,我想要设置某种侦听器,然后请求一个web页面并查看引擎执行的所有查询,或者只是查看在生产服务器上运行的所有查询。我该怎么做呢?

给定一个已经使用commit提交,然后使用revert恢复的更改,那么撤消该恢复的最佳方法是什么?

理想情况下,这应该通过一个新的提交来完成,这样就不会重写历史。

是否有一种方法可以对一个文件进行不同的提交。 假设我修改了一个文件5次,在我已经提交并推送到存储库之后,我想回到修改2。

在我的理解中,唯一的方法就是保留许多分支,对吗? 如果我是对的,几天内我就会有几百家分行,所以我可能不太理解。

有人能解释一下吗?

我注意到似乎没有从AWS管理控制台下载整个s3桶的选项。

有什么简单的方法可以把所有东西都装进我的桶里吗?我正在考虑使根文件夹公共,使用wget抓取它,然后再次使它私有,但我不知道是否有更简单的方法。

我运行了git状态,它告诉我一切都是最新的,没有本地更改。

然后我做了几次连续的改变,意识到我想扔掉一切,回到原来的状态。这个命令能帮我吗?

git reset --hard HEAD