Skip to main content

Posts

Showing posts with the label changing latest commit in git

CHANGING LATEST COMMIT IN GIT

Scenario: Consider we created a file change1 and commited it.Suppose we created a second file change2 and want to add this file to same commit.We can do this. First create a filechange1 and add it to index and commit it  # touch change1 #git add change1 #git commit change -m "change commit" Note the hash value of commit by git log Now create second file change2 and add it to index #touch change2 #git add change2 Now if we want both change1 and change2 to have same commit #git commit --ammend Now change the message of commit if we want and save it By using git-log we can see that the commit value is changed #git log