- Install Git from https://git-scm.com/download/win
- Navigate to the folder where you want to create the repository and type:
git init
- Set your name and address:
git config --global user.name "John Doe"
git config --global user.email johndoe@example.com
- Set your text editor. E.g. If your editor is sublime text, type:
git config --global core.editor "'C:/Program Files/Sublime Text/sublime_text.exe' -multiInst -nosession"
Common commands:
git status
Shows what files have changed since the last commit.
git log
Shows commit log
git add .
Adds all modified files to staging area
git commit
Commit/records changes to the repository. This will open up an associated editor (e.g. notepad, sublime text, etc).
git checkout -b [name_of_new_branch]
Create a new branch
git branch -d [name_of_branch]
Delete a branch
git ls-tree -r master --name-only
Shows a list of all files currently being tracked under the branch master.
git ls-tree -r HEAD --name-only
Shows a list of all files currently being tracked under the current branch.
git add .
git stash
git checkout master
This is to switch back to the head if you have checked out an earlier commit.
Other:
To ignore directories, i.e. directories you don't want to commit, edit the .git/info/exclude file and add the directory you want to ignore, e.g. if the folder you want to ignore is called Temp, add
Temp/ to the exclude file.
No comments:
Post a Comment