- Reporter: Brian
-
Terms
-
Staging
- mark changes of a file relavant to a version control
-
Committing
- add the changed file to the repository
-
Branching
- a total copy of the main stream
- can make modifications without affecting the main line of the code
- The default branch is called master.
- git branch
- git branch testing
- git push origin testing
- git checkout branchname
-
Merging
- merge different branches of features into one main line
- git merge testing
- git branch -d testing
- solve merging problems
-
Tags
- A tag points to a certain point in time in a specific branch.
-
Revision
- Represents a version of the source code.
-
Rebase
-
The rebase command allows you to combine several commits into one commit in one/more than one branch.
- one branch
-
more than one branch
- Rebase takes the changes of a branch, creates a patch and applies it to another branch.
- allows the user to rewrite some of the commit history (cleaning it up) before pushing your changes to a remote repository.
- git rebase master
-
Repository
- Every Git repository is stored in the .git folder of the directory in which the Git repository has been created.
- This directory contains the complete history of the repository.
- The .git/config file contains the local configuration for the repository.
-
Distributed Version Control
- allow many developers to work on a given project without necessarily being connected to a common network.
-
command line instructions
- git init
- git add .
- git commit -m "messages here"
- git log
- git diff
- git status
- gitk --all
- git commit --ammend -m "new messages here"
- delete files
- git amend(e.g. git commit --amend -m "More changes - now correct")
- git pull ../remote-repository.git/
- git clean -n
- git clean -f
-
git checkout commit_name
- can also be used to revert removed files
- git reset HEAD test01
-
Git repositories
- Local
-
Remote
-
To create such a repository, set the --bare flag.
- git remote add origin ../remote-repository.git
- git remote
-
distributed version control system
- Git keep track of all versions. Therefore you can revert to any point in your source code history.
- In a distributed version control system everyone has a complete copy of the source code