I am (somewhat)an experienced developer.
I am also googling “How to roll back a git commit” for the millionth time.
I haven’t read any books or longer tutorials on Git. The folks at my first company told me about 8 magical commands which are mostly used.
Here are the top 8 commands I use like a pro:
- git checkout X
- git checkout -b new-branch
- git commit
- git add .; git status;
- git pull — rebase
- git rebase origin/master
- git push origin X
Yet I find myself consulting Mr.Google about my git troubles few times a week. This needs to be changed.
“There is only one way and its about time. And there is only one thing we say to Git problems henceforth: ‘not today’.”
Git is coming!
If nothing is returned, now is the time to GIT out. But if you’re feeling Jaime Lannister kinda brave, go ahead install git from Here
A Repository Needs A Name.
git config --global user.name "Robert of the House Baratheon" git config --global user.email "[email protected]"
Lord of Seven kingdom needs a name. Any death sentence (commit) given out by the individual repository( kingdom like Winterfell ) will use this name globally.
A Single Repository Needs A Name.
cd /path-to-repo git config user.name "Daenerys Targaryen" git config user.email "[email protected]"
Robert, Robert Who? Daenerys Stormborn of the House Targaryen, First of Her Name, Blah Blah it is!
A Repository Needs No Name
git config --global --unset-all user.name git config --global --unset-all user.email
After Arya hung out with Jaqen H’ghar, she used –unset-all options to remove her name.
Creating repository, add, commit, clone & help
My Watch has started
This puts a directory under Night’s watch(version control).This creates a hidden folder .git (think of Jamie’s Bron) which contains plumbing needed for it to work.
Current character status: Dead (Y.O.L.O.S)
To review the list of files to be added to version control. (Avoid adding files with confidential information. The world is inundated with Littlefinger.)
Adding names in Arya Kill List
git add foldername/filename git add .
Ex. git add kill-folder/Walder Frey will add a single file to staging. But Arya has a huge list. No problem. Try Git add . to stage all of them
Committed To Honesty
git commit -m "Winter is coming"
This creates a new commit with the given message. If you omit the -m parameter, your default editor(VIMpire) will open and you can edit and save the commit message there.
Clone a White Walker
git clone https://github.com/nightking/whitewalker.git git clone https://github.com/nightking/whitewalker.git ArmyOfDead
Fastest Way for Night King to expand his army. Creates a directory called white walker on the local machine, containing all the files in the remote repository. To specify a different name of the dir, use the second command.
git #commandname --help git help willibeabletocompletethisseries git #commandname -h
After helping Sansa & Sam, you are next in line for getting help. Ask him anything.For Ex. use git diff help or git checkout -h
This is a WIP progress cheatsheet. Will be updated regularly. I know you might be wondering why can’t she write when done with all commands.
The Girl Had No Patience!
(Image Credit: Octodex)