Quantcast
Channel: Active questions tagged visual-studio-code - Stack Overflow
Viewing all articles
Browse latest Browse all 97400

Is it possible to revert only block of code changes of a commit?

$
0
0

So I am working with Visual Studio Code, and Sourcetree.

Let say I do have a file named Occupation.ts

Occupation.ts (Initial Commit)

private getOccupationCategoryTable(index: number): string {
    switch (index) {
        case 0:
        case 1: return 'occupationCategoryLookUpCommon';
        case 2: return 'occupationCategoryLookUpCreditCard';
        case 3: return 'occupationCategoryLookUpASB';
    }
}

private saveOccupationTable(index: number): string {
    switch (index) {
        case 0:
        case 1: return 'saveOccupationCategoryLookupCommon';
        case 2: return 'saveOccupationCategoryLookupCreditCard';
        case 3: return 'saveOccupationCategoryLookupASB';
    }
}

private updateOccupationTable(index: number): string {
    switch (index) {
        case 0:
        case 1: return 'updateOccupationLookupDetailCommon';
        case 2: return 'updateOccupationLookupDetailCreditCard';
        case 3: return 'updateOccupationLookupDetailASB';
    }
}

Now I made some changes with this file.

Occupation.ts (Latest Changes)

private getOccupationCategoryTable(index: number): string {
    switch (index) {
        case 0:
        case 1: return 'occupationLookUpCommon';
        case 2: return 'occupationLookUpCreditCard';
        case 3: return 'occupationLookUpASB';
    }
}

private saveOccupationTable(index: number): string {
    switch (index) {
        case 0:
        case 1: return 'saveOccupationLookupCommon';
        case 2: return 'saveOccupationLookupCreditCard';
        case 3: return 'saveOccupationLookupASB';
    }
}

private updateOccupationTable(index: number): string {
    switch (index) {
        case 0:
        case 1: return 'updateOccupationLookupDetailCommon';
        case 2: return 'updateOccupationLookupDetailCreditCard';
        case 3: return 'updateOccupationLookupDetailASB';
    }
}

So I made changes on getOccupationCategoryTable, and saveOccupationTable functions. Now I wanted to revert my changes only in getOccupationCategoryTable. Is there any git way to achieve this?


Viewing all articles
Browse latest Browse all 97400

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>