Git Study - bounswe/bounswe2018group7 GitHub Wiki
A Brief Introduction to GIT Platform
Basic Concepts to know
-
git is a distributed version control system.
-
It is different from other previous version control systems in mainly by enabling versioning in local repository.
-
Every commit is unique
-
Commits can never change
-
Commit ID is a hash of User, Date, Log, Previous ID
-
Basic Git workflow
Basic Commands
tell git who you are
git config --global user.name "John_Appleseed"
git config --global user.email [email protected]
initialize a git repository
git init
create a file called foo
git add foo
change foo
git commit foo
git diff
see the changes made
Create New Branch for separating your work
git brach NEW_BRANCH
git checkout NEW_BRANCH
do your stuff here
ex: add a file called "bar"
git checkout master
git merge NEW_BRANCH
if only addition done. Merge is done by fast-forwarding.
if a file is changed. merge done by recursive strategy
git push
send the changes to a remote repository
git fetch
Do a git fetch at any time to update your remote-tracking branches
git pull
A git pull is what you would do to bring a local branch up-to-date with its remote version, while also updating your other remote-tracking branches.
git stash
Use git stash when you want to record the current state of the working directory and the index, but want to go back to a clean working directory. The command saves your local modifications away and reverts the working directory to match the HEAD commit.