拉动

时间:2015-06-30 09:46:05

标签: git

我已将分支从远程拉到本地。它需要合并所有冲突文件。但我不想修复冲突并想要回滚我的最后提交以恢复我的工作流程。如果你有任何这个想法请给我。

2 个答案:

答案 0 :(得分:0)

您可以使用git reset --hard将分支重置为已知提交。如果我理解正确,您可以使用git reset --hard HEAD~1通过合并来反转更改。如果要重置为特定提交,可以使用git log查看提交及其哈希值,然后使用git reset --hard COMMIT_HASH重置为特定提交。

有关详细说明,建议您按照Atlassian tutorial

进行操作

P.S :硬重置会在没有警告的情况下丢弃任何未提交的更改,如果它们很重要,请隐藏或提交它们。

答案 1 :(得分:0)

如果您尚未完成合并(使用final Context context = this; public EditText test; RelativeLayout layout; public EditText data; String value; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayShowHomeEnabled(true); actionBar.setIcon(R.mipmap.ic_launcher); layout = (RelativeLayout) findViewById(R.id.main); data = (EditText) findViewById(R.id.dialog); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. //getMenuInflater().inflate(R.menu.menu_main, menu); getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.add_item) { add_item(); return true; } else if(id == R.id.action_settings) { Intent intent = new Intent(getBaseContext(), SettingsActivity.class); startActivity(intent); return true; } return super.onOptionsItemSelected(item); } private void add_item() { LayoutInflater li = LayoutInflater.from(context); View dialog = li.inflate(R.layout.dialog, null); AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context); alertDialogBuilder.setView(dialog); alertDialogBuilder .setCancelable(false) .setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { value = data.getText().toString(); TextView tv = new TextView(context); tv.setText(value); tv.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); layout.addView(tv); Toast.makeText(context, value, Toast.LENGTH_LONG).show(); } }) .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); // create alert dialog AlertDialog alertDialog = alertDialogBuilder.create(); // show it alertDialog.show(); } ),则可以使用git commit中止合并。

相关问题