I have started learning git ( which is very famous and widely used tool for code repository and version control ).
Basic commands which I use normally are ::
1. git clone URL – this is to clone the repo
2. git pull – to pull the content from repo
3. git branch – It tells which branch you are on, and of course to change the branch
4. git add, git commit and git push – to add, commit and push the local changes to git.
Now, there is a command which I am using lately to push my changes to git for review::
git push origin HEAD:refs/for/RHEL71 –
And, I had this question, what is origin in this command? I had different answers from different people. But nothing satisfied me. After some more reading this the conclusion::
ORIGIN – origin is the alias of remote git repo which we have cloned. It is not the NAME of remote repository infect, it is an ALIAS given to the URL which points to the default remote repository.
There can be multiple repos cloned, and you can see what url belongs to each remote by using ::
git remote -v
While pushing, you can use remotes or you can simply use a url directly ::
git push email@example.com:git/git.git master
You can see more info about the remote by typing
git remote show origin
And interestingly, you can change this alias anytime you want using ::
git remote rename origin anotherAliasNameForTheRepoUrl
Since, I am in learning phase and there will be many more things which I would like to explore, you can expect more post on git from me 🙂