Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the hueman domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/CloudIngenium.com/htdocs/wp-includes/functions.php on line 6114
How to: Use Git (Git Clone, Git Fetch, Git Pull, Git Clone & Git Rebase) – Knowledge eXchange

How to: Use Git (Git Clone, Git Fetch, Git Pull, Git Clone & Git Rebase)

How to: Use Git (Git Clone, Git Fetch, Git Pull, Git Clone & Git Rebase)

I am new to Git and using repositories in Linux based systems (Being a Visual Studio / Team Foundation guy is not like I am starting from scratch). The point was just to understand what does each command does so I can adequately make and get updates of the code. If anything I still fear I am going to screw up but thus far this is what I have gathered from the Internet and the git man page.

Git Clone

This is where it all begins. Git clone allows you to clone an existing repository into a newly crated directory in your local machine. This creates a new origin for the repository creating a local branch out of the active branch which is generally master.

Git Fetch

As the name implies this will fetch the latest version of a given branch. It will not do any merging and if you want to work on it you should perform a checkout of the branch. Think of this as getting a local copy of a remote branch which will overwrite whatever you have.

Git Pull

Similar to Fetch it will get the latest version of a given branch but this time it will merge with what you have. So if you want to keep your changes you will use a Pull while Fetch will get rid of them (good for when you’ve messed something up right? lol.)

Git Rebase

From what I understand this is like a Git Pull but cooler (unless it is the same thing but I didn’t get that.) What it will do is analyse the changes you’ve made to the branch and record them in a temporary area. Then it will perform a pull from the server with the latest information and once it is done it will replay the changes you had made into the latest version of the branch. The advantage here is that the changes you’ve made can be applied to newer versions. It is like doing a pull request locally to a branch.

As a new user to version control and Git could gather, it can get pretty confusing. Just get a test repository and play with the commands so you can see how they work. And remember, if you mess something up version control is there to allow you to revert changes so for the most time you are in safe territory… but be careful nonetheless.

Enhanced by Zemanta

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.