Merge Conflicts: Git Mergetool - Tool Meld
Merge Conflicts: Git Mergetool - Tool Meld
Merge Conflicts: Git Mergetool - Tool Meld
Working tree
The user works on a collection of files which may originate from a certain point in time of the
repository. The user may also create new files or change and delete existing ones. The current
collection of files is called the working tree.
A standard Git repository contains the working tree (single checkout of one version of the project) and
the full history of the repository. You can work in this working tree by modifying content and
committing the changes to the Git repository.
staging area term is currently preferred by the Git community over the old index term. Both terms
mean the same thing.)
You add changes in the working tree to the staging area with the git add command.
The git add command allows you to incrementally modify files, stage them, modify
and stage them again until you are satisfied with your changes.
After adding the selected files to the staging area, you can commit these files to
permanently add them to the Git repository. Committing creates a new persistent
snapshot (called commit or commit object) of the staging area in the Git
repository. A commit object, like all objects in Git, are immutable.
For committing the staged changes you use the
By default you can only push to bare repositories (repositories without working
tree).
Pull changes
The git pull command allows you to get the latest changes from another repository
for the current branch.
Assuming you have a remote all set up and you want to pull in updates, you would first run git
fetch [alias] to tell Git to fetch down all the data it has that you do not, then you would run git
merge [alias]/[branch] to merge into your current branch anything new you see on the server
(like if someone else has pushed in the meantime). So, if you were working on a Hello World project
with several other people and wanted to bring in any changes that had been pushed since we last
connected, we would do something like this:
$ git fetch github
remote: Counting objects: 4006, done.
remote: Compressing objects: 100% (1322/1322), done.
remote: Total 2783 (delta 1526), reused 2587 (delta 1387)
Receiving objects: 100% (2783/2783), 1.23 MiB | 10 KiB/s, done.
Resolving deltas: 100% (1526/1526), completed with 387 local objects.
From github.com:schacon/hw
8e29b09..c7c5a10 master
-> github/master
0709fdc..d4ccf73 c-langs
-> github/c-langs
6684f82..ae06d2b java
-> github/java
* [new branch]
ada
-> github/ada
* [new branch]
lisp
-> github/lisp
Here we can see that since we last synchronized with this remote, five branches have been added or
updated. The 'ada' and 'lisp' branches are new, where the 'master', 'c-langs' and 'java' branches have
been updated. In our example case, other developers are pushing proposed updates to remote branches
-------------------------------------------------------------------------------------
-----------------------------
Commit reference
Using caret (^) and tilde (~)
[revision]~1 describes the first predecessor of the commit object accessed via [revision]. [revision]~2 is
the first predecessor of the first predecessor of the [revision] commit. [revision]~3 is the first
predecessor of the first predecessor of the first predecessor of the [reference] commit, etc.
[revision]~ is an abbreviation for [revision]~1.
For example, you can use the HEAD~1 or HEAD~ reference to access the first [revision] of the commit
to which the HEAD pointer currently points.
[reference]^1 also describes the first predecessor of the commit object accessed via [reference].
The difference is that [reference]^2 describes the second predecessor of a commit. A merge commit has
two predecessors.
For example, you can ask Git to show all commits which happened between HEAD and HEAD~4.
git log HEAD~4..HEAD
This also works for branches. To list all commits which are in the "master" branch but not in the
"testing" branch, use the following command.
git log testing..master