Last active
August 6, 2019 06:20
-
-
Save Eyakub/1f46486fca56ae6297459d7e1ac7a100 to your computer and use it in GitHub Desktop.
My Git CMD Usage & Laravel CMD usage
This file contains hidden or 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
/* this is too pull from github repo update | |
* and get it from repo | |
*/ | |
git fetch --all | |
git reset --hard origin/master | |
*** clear git cache, .gitignore fix *** | |
git rm -r --cached . | |
/** | |
update git from local repo | |
git stash | |
git pull origin master | |
git stash apply | |
git add . | |
git commit -m "" | |
git push origin master | |
//clone updated from git | |
git pull origin master | |
git fetch | |
//check git status | |
git status | |
//GIT .gitignore usage | |
git rm -r -f --cached [file/folder name] | |
git commit -m "message" | |
git push -u origin branch_name | |
//switch branch | |
git checkout branch_name | |
//create new branch | |
git checkout -b new_branch_name | |
git checkout new_branch_name | |
git push origin new_branch_name | |
Add a new remote for your branch : | |
$ git remote add [name_of_your_remote] | |
Update your branch when the original branch from official repository has been updated : | |
$ git fetch [name_of_your_remote] | |
Then you need to apply to merge changes, if your branch is derivated from develop you need to do : | |
$ git merge [name_of_your_remote]/develop | |
Delete a branch on your local filesystem : | |
$ git branch -d [name_of_your_new_branch] | |
To force the deletion of local branch on your filesystem : | |
$ git branch -D [name_of_your_new_branch] | |
Delete the branch on github : | |
$ git push origin :[name_of_your_new_branch] | |
//delete branch | |
git branch -D branch_name | |
//switch branch & make it current branch | |
git checkout branch_name | |
//cloing a repo and update it to own repo | |
git remote set-url origin http://github.com/you/your_repo | |
//if original repo would update often and you want to get those updates from time to time, | |
//then instead of editing ORIGIN it would be best to add a new REMOTE | |
git remote add personal https://github.com/you/your_repo | |
//or maybe even call the old one UPSTREAM | |
git remote rename origin upstream | |
git remote add origin http://github.com/you/your_repo | |
//then, whenever you want to get changes from UPSTREAM, you can do | |
git fetch upstream | |
// IF wanna import project somewhere to repo | |
git remote add github https://[email protected]/yourLogin/yourRepoName.git | |
git push --mirror github | |
//add multiple git account on same machine | |
windows 10 -> credential manager > windows credential > add generic credential > put your desire network link > email as username > password |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment