Git - Revision Control Perfected
A remote named "origin" is configured automatically when a repository
is created using
git clone. Consider a clone of Linus Torvald's Kernel
Tree mirrored on GitHub:
git clone https://github.com/mirrors/linux-2.6.git
If you look inside the new repository's config file (.git/config), you'll see these lines set up:
[remote "origin"] fetch = +refs/heads/*:refs/remotes/origin/* url = https://github.com/mirrors/linux-2.6.git [branch "master"] remote = origin merge = refs/heads/master
The fetch line above defines the remote tracking branches. This "refspec" specifies that all branches in the remote repository under "refs/heads" (the default path for branches) should be transferred to the local repository under "refs/remotes/origin". For example, the remote branch named "master" will become a tracking branch named "origin/master" in the local repository.
The lines under the branch section provide defaults—specific to the
master branch in this example—so that
git pull can be called with
no arguments to fetch and merge from the remote master branch into the
local master branch.
git pull command is actually a combination of the
git fetch and
git merge commands. If you do a
fetch instead, the tracking branches
will be updated and you can compare them to see what changed. Then you
can merge as a separate step:
git merge origin/master
Git also provides the
git push command for uploading to a remote
repository. The push operation is essentially the inverse of the pull
operation, but since it won't do a remote "checkout" operation, it is
usually used with "bare" repositories. A bare repository is just the
git database without a working copy. It is most useful for servers where
there is no reason to have editable files checked out.
git push will allow only a
"fast-forward" merge where the
local commits derive from the remote head. If the local head and remote
head have both changed, you must perform a full merge (which will create a
new commit deriving from both heads). Full merges must be done locally,
so all this really means is you must call
if someone else committed something first.
This article is meant only to provide an introduction to some of Git's most basic features and usage. Git is incredibly powerful and has a lot more capabilities beyond what I had space to cover here. But, once you realize all the features are based on the same core concepts, it becomes straightforward to learn the rest.
Check out the Resources section for some sites where you can learn more. Also, don't forget to read the git man page.
Git Home Page: http://git-scm.com
Git Community Book: http://book.git-scm.com
Why Git Is Better Than X: http://whygitisbetterthanx.com
Google Tech Talk: Linus Torvalds on Git: http://www.youtube.com/watch?v=4XpnKHJAok8
Fast/Flexible Linux OS Recovery
On Demand Now
In this live one-hour webinar, learn how to enhance your existing backup strategies for complete disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible full-system recovery solution for UNIX and Linux systems.
Join Linux Journal's Shawn Powers and David Huffman, President/CEO, Storix, Inc.
Free to Linux Journal readers.Register Now!
|Fancy Tricks for Changing Numeric Base||May 29, 2016|
|Working with Command Arguments||May 28, 2016|
|Secure Desktops with Qubes: Installation||May 28, 2016|
|CentOS 6.8 Released||May 27, 2016|
|Secure Desktops with Qubes: Introduction||May 27, 2016|
|Chris Birchall's Re-Engineering Legacy Software (Manning Publications)||May 26, 2016|
- Tips for Optimizing Linux Memory Usage
- Secure Desktops with Qubes: Introduction
- Working with Command Arguments
- Download "Linux Management with Red Hat Satellite: Measuring Business Impact and ROI"
- Secure Desktops with Qubes: Installation
- Fancy Tricks for Changing Numeric Base
- CentOS 6.8 Released
- Linux Mint 18
- The Italian Army Switches to LibreOffice
- Petros Koutoupis' RapidDisk
Until recently, IBM’s Power Platform was looked upon as being the system that hosted IBM’s flavor of UNIX and proprietary operating system called IBM i. These servers often are found in medium-size businesses running ERP, CRM and financials for on-premise customers. By enabling the Power platform to run the Linux OS, IBM now has positioned Power to be the platform of choice for those already running Linux that are facing scalability issues, especially customers looking at analytics, big data or cloud computing.
￼Running Linux on IBM’s Power hardware offers some obvious benefits, including improved processing speed and memory bandwidth, inherent security, and simpler deployment and management. But if you look beyond the impressive architecture, you’ll also find an open ecosystem that has given rise to a strong, innovative community, as well as an inventory of system and network management applications that really help leverage the benefits offered by running Linux on Power.Get the Guide