Skip to content

Instantly share code, notes, and snippets.

@lg3bass
Last active January 30, 2018 03:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lg3bass/9238673 to your computer and use it in GitHub Desktop.
Save lg3bass/9238673 to your computer and use it in GitHub Desktop.
MyGitList
//Create a new git repo. Concise instruction right from Git.
//Use this BOB!!!!!!!!!
//https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
//http://stackoverflow.com/questions/3311774/how-to-convert-existing-non-empty-directory-into-a-git-working-directory-and-pus
//RESOURCES:
//http://rogerdudler.github.io/git-guide/
//assuming your remote branch is up-to-date. Get rid of all your local changes and revert back to what is on the server.
git checkout -- .
//source: http://stackoverflow.com/questions/52704/how-do-you-discard-unstaged-changes-in-git
//also if you can't pull from remote cuase some specific file is changed. Git is asking if you want to stash or commit changes. Actually I want to delete all changes and revert back to remote.
//To unstage one file :
$ git checkout <path-to-file>
//EXAMPLE: git checkout OF_9.8/VMMtimeline_9-8/VMMtimeline_9-8.xcodeproj/project.xcworkspace/xcuserdata/uwhitbo.xcuserdatad/UserInterfaceState.xcuserstate
//get one file.
git checkout -- <<name-of-file>>
e.g. git checkout -- animationMachine.xcodeproj/project.pbxproj
//you can't checkout a branch cause there are untracked changes.
git clean -df
git checkout -- .
//upload changes to git
git add -A
git status -s //verify you're sending up the right stuff
git commit -m "added/fixed stuff"
git push
//Find out what remote branch your working on. This shows what this folder is tied to on github.com
git remote show origin
//force local and overwrite files
git fetch --all
git reset --hard origin/master
git pull origin master
//another way to do this from http://rogerdudler.github.io/git-guide/
git fetch origin
git reset --hard origin/master
//You accidentally added a folder you didn't want BEFORE git commit
//Remove the folder and all files within
git reset bin/data/obj/00_oddity_domb_OBJ_Seq/*
//You want to remove all the .DS_Store files recursively
git rm \*.DS_Store
source: https://git-scm.com/docs/git-rm >>>>#EXAMPLES
//You committed and pushed something you dont want in your remote.
//To stop tracking a file that is currently tracked, use git rm --cached.
git rm --cached bin/data/obj_unused/00_oddity_domb_OBJ_Seq/oddityDomb20_0-30_OBJ_Seq/*.obj
git commit -m "Removed file that shouldn't be tracked"
git push //pushes changes to remote
//Say you get lost in the emacs editor
git commit
Added hi tag
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: hello.html
#
//On the first line, enter the comment: “Added hi tag”.
//Save the file and exit the editor (to do it in default editor, press ESC and then type :wq and hit Enter).
//You should see …
//https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging
//git merge
//first check out the master
git checkout master
//next merge the branch
git merge <branchname>
//resolve conflicts
//delete a branch from your local
git branch -d <branchname>
git branch -D <branchname> //not fully merged. force delete
//Pushing to Bitbucket(Pearson) if you get an authentication message:
USRLSML-2HLDV7L:generators uwhitbo$ git push
fatal: Authentication failed for 'https://UWHITBO@bitbucket.pearson.com/scm/hssl/generators.git/'
USRLSML-2HLDV7L:generators uwhitbo$ git push origin master
Password for 'https://UWHITBO@bitbucket.pearson.com':
Counting objects: 7, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (7/7), 705 bytes | 0 bytes/s, done.
Total 7 (delta 6), reused 0 (delta 0)
To https://bitbucket.pearson.com/scm/hssl/generators.git
71d2874..31ae037 master -> master
USRLSML-2HLDV7L:generators uwhitbo$ git status -s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment