Managing Git Remote and Viewing the History
What is Git Remote ?
Git remote is the main repository server which your folder pointing too.
Find Your Repository Remote Location
By using above command you will know the remote name, to know more info you can run below command, replace orange text with the output of above command :
git remote show remote-name
Set Remote using SSH
- Create SSH Key from server command line.
- Copy the pub content to Github/Settings/SSH.
- Get SSH URL from you account in github and then scroll down to clone url and click on ssh and then copy the url appears.
- Run the following command:
git remote set-url origin paste-url-here
What are Master, Origin and Head ?
- Master -- The name of default branch "Local"
- Origin -- Default name of the the remote.
- Head -- The current commit your repo is on now.
What are Git Refs?
With each commit you get a reference number or a ref and stored in .git/refs.
How Commit Works ?
Let us have an example of three files were created and we did commit, in the second commit we changed only file #2, in this case Git will have new copy for file #2 but the other files #1 and #3 will remain the same so it will just put a pointer to the first state.
Viewing Git History
To view History/Log/Commits history from Github website simply loging and click commits and you will get something like below:
Git History From Command Line
git log particular-file.pl
git log branch-name