Find your content:

Search form

Learn Git - How to check who is committed?

 
Share

Learn Git - How to check who is committed?

git log

It will produce big list of commits. If you want to show only one commit

git show <<commitid>>

To check the difference between two commits

git diff <<commitid>>..<commitid>>

How to resolve merge conflict?

Lets look at the below snippet

for(let i = 0; i < 10;i++)
console.log(i);

user1 using the above code in the file1.js

User is updating the below code in the same file
arr.forEach(function(item){
console.log(item);
})

They both commit their code on their respective branch. Now if they try to merge the two branches they will see the following error

git merge user1_branch

<<<<<<< HEAD
// Use a for loop to console.log contents.
for(var i=0; i<arr.length; i++) {
console.log(arr[i]);
}
=======
// Use forEach to console.log contents.
arr.forEach(function(item) {
console.log(item);
});
>>>>>>> User2's commit

Now we know which is the best version if you think both are not delete from head to end >>>> and update the best code
console.log(arr.toString());


What is Git Amend?
If you want make any changes in the existing commit please use amend command.

git commit --amend

It open up a editor with old commit, you can modify the commit and save it.

 

 

 

My Block Status

My Block Content