Created
July 3, 2014 11:52
-
-
Save hemantajax/069bb80fe16732543fad to your computer and use it in GitHub Desktop.
Git Basics
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Git Config: | |
☐ git config --global user.name "John Doe" | |
☐ git config --global user.email [email protected] | |
Check your config setting: | |
You can use git config --list, or look at your ~/.gitconfig file. Local config will be in your repository's .git/config file. | |
Configure Diff tool- ~/.gitconfig: | |
[merge] | |
tool = kdiff3 | |
[mergetool "kdiff3"] | |
path = c:/Program Files (x86)/KDiff3/kdiff3.exe | |
[diff] | |
tool = kdiff3 | |
guitool = kdiff3 | |
[difftool "kdiff3"] | |
path = c:/Program Files (x86)/KDiff3/kdiff3.exe | |
☐ git add . | |
☐ git status | |
☐ git commit -m "yes 1ste" | |
☐ git diff | |
✔ Branching: @done (14-07-03 15:35) | |
☐ git branch xyz ( just create a branch) | |
☐ git checkout xyz | |
Create branch and switch to it: | |
☐ git checkout -b xyz | |
☐ git branch - list out all branches | |
- before merging branch make sure all branches are clean ( no un tracked, modified files) | |
☐ git merge xyz ( you are in master branch here, whre you want to see changes) | |
✔ One line add and commit @done (14-07-03 16:16) | |
git commit -a -m "Yes both" | |
Now you want to delete the branch that merged in master: | |
☐ git branch --merged | |
or | |
☐ git branch --no-merge | |
☐ git branch -d xyz | |
Deleting branch whether it's merged or not: | |
☐ git branch -D xyz | |
Adding multiple remote: | |
fatal: remote origin already exists - GitHub | |
☐ | |
git remote add myRemote https://github.com/hemantajax/html5-project.git (multiple remote) | |
or | |
git remote add origin https://github.com/hemantajax/html5-project.git | |
☐ git remote -v | |
☐ git push -u origin master | |
or | |
git push -u myRemote master (multiple remote) | |
Can I specify multiple users for myself in .gitconfig? : | |
http://stackoverflow.com/questions/4220416/can-i-specify-multiple-users-for-myself-in-gitconfig | |
You can configure an individual repo to use a specific user / email address. | |
git config user.name "Your Name Here" | |
git config user.email [email protected] | |
where as the default user / email is configured in your ~/.gitconfig | |
git config --global user.name "Your Name Here" | |
git config --global user.email [email protected] | |
OR........ | |
update .git/config | |
[user] | |
name = Your Name | |
email = [email protected] | |
Git push failed, “Non-fast forward updates were rejected”: | |
http://stackoverflow.com/questions/6897600/git-push-failed-non-fast-forward-updates-were-rejected | |
☐ git push myRemote master --force | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment