Total Pageviews

2014/12/15

How to revert changes in EGit

Assume I have a form bean in gov.nta.dbm.web.dto

The form bean is as following:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
package gov.nta.dbm.web.dto;

import java.io.Serializable;

import org.apache.commons.lang.builder.ToStringBuilder;

import lombok.Data;

@Data
public class Dbm915rFormBean implements Serializable{
    /**
     * 
     */
    private static final long serialVersionUID = 1L;

    private int year = 0;
    private int month = 0;
    
    public String toString() {
        return ToStringBuilder.reflectionToString(this);
    }
}

If I add one more attribute in this form bean:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package gov.nta.dbm.web.dto;

import java.io.Serializable;

import org.apache.commons.lang.builder.ToStringBuilder;

import lombok.Data;

@Data
public class Dbm915rFormBean implements Serializable{
    /**
     * 
     */
    private static final long serialVersionUID = 1L;

    private int year = 0;
    private int month = 0;
    private String type;
    
    public String toString() {
        return ToStringBuilder.reflectionToString(this);
    }
}

We can see this form bean had been modified and add ">" icon before file name to remind us this file had been modified.

If I would like to revert its changes, just right click => Replace with => HEAD Revision

Click OK to make sure to discard changes.

We can see the ">" label is disappeared.

And the form bean had been revert to original version:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
package gov.nta.dbm.web.dto;

import java.io.Serializable;

import org.apache.commons.lang.builder.ToStringBuilder;

import lombok.Data;

@Data
public class Dbm915rFormBean implements Serializable{
    /**
     * 
     */
    private static final long serialVersionUID = 1L;

    private int year = 0;
    private int month = 0;
    
    public String toString() {
        return ToStringBuilder.reflectionToString(this);
    }
}


If you find out your revert action is success, but the ">" label still show in Eclipse.
Its EGit bug, go to its website ( http://eclipse.org/egit/download/ ) to update your EGit version.

No comments: