Assume that there is a local git repository and youve create

Assume that there is a local git repository, and you\'ve created a file called Hello.java in the current directory and you have added it to the staging area. Write the full command to make a snapshot of the Hello.java file:(with a message of your choice).

Solution

1. The git commit command takes all the file contents that have been staged with git add and records a new permanent snapshot in the database and then moves the branch pointer on the current branch up to it.

Therefore, to create a snapshot with a message:

git commit -m \"Hello.java added\"

where -m is a flag used to add a message.

2.

git fetch downloads any changes from the remote branch, updating your repository data, but leaving your local branch unchanged.

Whereas, git pull performs a fetch and additionally merge the changes into your local branch.

What\'s the difference? pull updates you local branch with changes from the pulled branch. A fetch does not advance your local branch.

 Assume that there is a local git repository, and you\'ve created a file called Hello.java in the current directory and you have added it to the staging area. W

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site