Created
June 23, 2011 12:25
-
-
Save fajrif/1042446 to your computer and use it in GitHub Desktop.
my usual git command
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 init | |
# => initialize local repository | |
git add . | |
# => add all files/folders into the staging area | |
git add -A | |
# => add all files/folders into the staging area | |
# => (include the changes in the entire tree) | |
git commit -m <your message> | |
# => commit your changes with messages | |
git status | |
# => Checking the status of your repository | |
git reset --hard ORIG_HEAD | |
# => Reverting changes to original HEAD / commmit | |
git checkout -b <new_branch_name> | |
# => create new branch and switch to the new branch | |
# => (do commit first) | |
git branch -l | |
# => list all existing branches | |
git checkout <branch_name> | |
# => switch to the branch | |
git branch -D <branch_name> | |
# => remove the branch | |
# => (cannot delete the branch which you currently on) | |
# => (ignore the fully merge) | |
git push <repo_name> :<repo_branch_name> | |
# => remove branch on remote repository | |
# => the branch have to be inactive on the remote repository | |
git config --list | |
# => list the local configuration info | |
git remote add <remote_name> <repo_destination> | |
# => add remote repository destination address | |
# => (usually named origin `git remote add origin [email protected]:fajrif/fetty-generators.git`) | |
git push <repo_name> <branch_name> | |
# => push local branch repository to the remote repository | |
# => (usually use `git push origin master`) | |
git remote show <repo_name> | |
# => will display list of remote branch on repository | |
# => and local branch that tracked with remote repository | |
git show-ref | |
# => Display the references within your current repository (local) | |
# => each git-pull / git-fetch / git-push are using references | |
# => defined on refspec (usually like this '+refs/heads/*:refs/remotes/remote/*') | |
git ls-remote <repo_name> | |
# => Display the references in a remote repository. | |
git reflog | |
# => Display the log references recent commit, merge, checkout, etc. | |
git reset --hard HEAD | |
# => return the entire working tree to the last committed state | |
git pull <repo_name> <refspec> | |
# => pull data / changes from remote repository | |
# => `git pull` will pull all the branches from remote into local repository | |
# => set the repo_name and refspec if you want only pulling from specific branch | |
git merge <branch_name> | |
# => merge all files and changes onto the current branch | |
# => you have to checkout / switch to the destination branch first | |
# => if conflict appears you have to modified the files using editor | |
git config --global alias.co checkout | |
# => set global configuration to create alias "co" for "checkout" | |
# => another example to create aliases (git config --global alias.b branch) | |
# => will create alias "b" for "branch" | |
# => you also able to change configuration on '~/.gitconfig' for global, '.git/config' for local | |
git config --global apply.whitespace nowarn | |
# => set gitconfig to ignore whitespace (Ruby is whitespace insensitive) | |
git tag -a <version> -m <message> | |
# => create annotated tag specify the version and message | |
git push --tags | |
# => push all tags to remote repositories | |
git rm --cached <filename> | |
# => untrack certain files, for folder use -r option for recursively | |
# => or try use this command `git update-index --assume-unchanged <filename>` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment