最近从Subversion切换到Git,我看到了以下内容:
我可以理解为什么这会发生在Git而不是Subversion。由于Git没有权威性的副本,因此它没有按时间顺序排列的信息,即您是否正在进行更改以撤消其他人的更改。但是我不希望这种情况发生,引入错误,并且必须在以后跟踪它们,就像我已经两次发生过一样。
我还没有能够以简单的方式重现这一点。但这必须是一个常见问题(尽管在搜索SO时很难)。
谢谢。
更新
谢谢@jthill 这是git log --graph --oneline rev ... rev的输出; --describe似乎不是一个有效的参数:
* db3bf80 Merge branch 'master' of //(obscured)
|\
| * a2e54a9 Fixed some tests after the percent formatter change.
| * 6d4fa0c Changed 3 more metrics from Percent to Ratio.
| * 8504823 Changed percent formatting to return 2 digits past the decimal point, instead of 1.
| * 0597c04 Set DECIMAL as a numeric type that can be averaged. Changed external hire ratio from a percent to a ratio.
* fff6167 Added new Talent Flow sql and template.
* cbca9a2 Added new Talent Flow dummy query and report constant. Added exception for "can't find template json". Added 0
3个相关提交是:
git show:
$ git show cbca9a2:
diff --git a/src/(obscured)/ReportBuilder.java b/src/(obscured)/ReportBuilder.
index 37c484b..7208619 100644
--- a/src/(obscured)/ReportBuilder.java
+++ b/src/(obscured)/ReportBuilder.java
@@ -22,6 +22,8 @@ public class ReportBuilder {
public Report build(String reportUrl) {
ReportTemplate template = readTemplate(reportUrl);
+ if (template == null)
+ throw new IllegalArgumentException("Could not find a template for report: " + reportUrl, new Nul
return template.makeReport();
}
$ git show 0597c04:
(does not show any changes on the relevant lines)
$ git show db3bf80
commit db3bf80db620230ebb5190f6acd33cf55a1d7a19
Merge: fff6167 a2e54a9
Author: Michael
Date: Tue Apr 1 13:21:01 2014 -0600
Merge branch 'master' of //(obscured)
git config:
$ git config -l
core.symlinks=false
core.autocrlf=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
pack.packsizelimit=2g
help.format=html
http.sslcainfo=/bin/curl-ca-bundle.crt
sendemail.smtpserver=/bin/msmtp.exe
diff.astextplain.textconv=astextplain
rebase.autosquash=true
gui.recentrepo=C:/(obscured)
user.email=(obscured)
user.name=Michael
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true
core.hidedotfiles=dotGitOnly
remote.origin.url=//(obscured)
remote.origin.puttykeyfile=
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
remote.originname.url=//(obscured)
remote.originname.fetch=+refs/heads/*:refs/remotes/originname/*
git reflog:
db3bf80 HEAD@{105}: commit (merge): Merge branch 'master' of //(obscured)
fff6167 HEAD@{106}: commit: Added new Talent Flow sql and template.
cbca9a2 HEAD@{107}: commit: Added new Talent Flow dummy query and report constant.
第二次更新:
^ 1到^ 2:
index 37c484b..9dcd40e 100644
--- a/src/com/opttek/optforce/data/report/ReportBuilder.java
+++ b/src/com/opttek/optforce/data/report/ReportBuilder.java
@@ -40,12 +40,13 @@ public class ReportBuilder {
return template;
}
-
+
+ // TODO: remove just get a key here
private static String getWarName() {
- Properties serverProps = new ServerContext().getServerProperties();
- String jndi = serverProps.getProperty("war-name");
- if (jndi == null)
+ Properties properties = new ServerContext().getServerProperties();
+ String warName = properties.getProperty("war-name");
+ if (warName == null)
Logging.appLog.severe("Unable to read the war-name value in server.properties");
- return jndi;
+ return warName;
}
}
\ No newline at end of file
^ 2到^ 1:
index 37c484b..7208619 100644
--- a/src/com/opttek/optforce/data/report/ReportBuilder.java
+++ b/src/com/opttek/optforce/data/report/ReportBuilder.java
@@ -22,6 +22,8 @@ public class ReportBuilder {
public Report build(String reportUrl) {
ReportTemplate template = readTemplate(reportUrl);
+ if (template == null)
+ throw new IllegalArgumentException("Could not find a template for report: " + reportUrl, new Nul
return template.makeReport();
}
@@ -40,7 +42,7 @@ public class ReportBuilder {
return template;
}
-
+
private static String getWarName() {
Properties serverProps = new ServerContext().getServerProperties();
String jndi = serverProps.getProperty("war-name");
@@ -48,4 +50,4 @@ public class ReportBuilder {
Logging.appLog.severe("Unable to read the war-name value in server.properties");
return jndi;
}
-}
\ No newline at end of file
+}
答案 0 :(得分:0)
如果其他人更改了代码的相同部分,那么合并时应该会发生冲突
如果你想独自离开,一个解决方案是:
您可以为本地作业创建一个新的tmp分支,只有在您完成作业时,才将其合并到主分支中。因此,任何机构都不会修改您当地的tmp分支
创建分支非常简单&轻巧,只需1个命令& 41个字节。