-
repo -> repository
-
clone
-> bring a repo down from the internet (remote repository like Github) to your local machine -
add
-> track your files and changes with Git -
commit
-> save your changes into Git -
push
-> push your changes to your remote repo on Github (or another website) -
pull
-> pull changes down from the remote repo to your local machine -
status
-> check to see which files are being tracked or need to be commited -
init
-> use this command inside of your project to turn it into a Git repository and start using Git with that codebase
-
-
Save gwenf/19e5748a5391929e8e938a22c8a4b3f2 to your computer and use it in GitHub Desktop.
This is awesome and helpful, Thanks Gwen
TOP GITHUB COMMANDS
- git config –global user.name “[name]” ->sets author name
git config –global user.email “[email address]” ->sets author email id- git init [repository name] ->start new repository
- git clone [url] ->obtain a repository from an existing URL.
- git add [file] ->adds a file to the staging area.
- git commit -m “[ Type in the commit message]” ->records or snapshots the file permanently in the version history.
git commit -a ->commits any files you’ve changed since then.&commits any files you’ve added- git diff ->shows the file differences which are not yet staged.
git diff –staged ->differences between the files in the staging area and the latest version present.
git diff [first branch] [second branch] ->differences between the two branches mentioned.- git reset [file] ->unstages the file, but it preserves the file contents.
git reset [commit] ->undoes all the commits after the specified commit and preserves the changes locally.
git reset –hard [commit] ->discards all history and goes back to the specified commit.- git status ->command lists all the files that have to be committed.
9 ) git rm [file] ->deletes the file from your working directory and stages the deletion.
- git log ->used to list the version history for the current branch.
git log –follow[file] ->lists version history for a file, including the renaming of files also.- git show [commit] ->shows the metadata and content changes of the specified commit.
- git tag [commitID] ->used to give tags to the specified commit.
- git branch ->lists all the local branches in the current repository.
git branch [branch name] -> creates a new branch.
git branch -d [branch name] -> deletes the feature branch.- git checkout [branch name] -> used to switch from one branch to another
git checkout -b [branch name] ->creates a new branch and also switches to it.- git merge [branch name] ->merges the specified branch’s history into the current branch.
- git remote add [variable name] [Remote Server Link] ->used to connect your local repository to the remote server.
- git push [variable name] master ->sends the committed changes of master branch to your remote repository.
git push [variable name] [branch] ->sends the branch commits to your remote repository.
git push –all [variable name] ->pushes all branches to your remote repository.
git push [variable name] :[branch name] ->deletes a branch on your remote repository.- git pull [Repository Link] ->fetches and merges changes on the remote server to your working directory.
- git stash save ->stores all the modified tracked files.
- git stash pop ->restores the most recently stashed files.
git stash list ->lists all stashed changesets.
git stash drop ->discards the most recently stashed changeset.
What a cool list of commands. Thank you for it.
Thanks!
That's awesome, thanks a lot
Very helpful. Thank you
thanks dude that's helped me a lot
thanks dude that's helped me a lot
Thanks
Thank you, everyone.
git checkout 'branch-name' -> helps to switch between branches locally
git branch -d 'branch-name' -> helps to delete branches locally
git checkout -b 'branch-name' -> helps to create a new branch locally
git merge 'branch-name' -> helps to merge branches together locally
So after generating the ssh key? How do I display them on the Git Bash command? I need help on that please. I have used various prompt but it still not showing
okay to display the ssh key you use "cat key_name.pub"
hope that was helpful
@BertinAm it did not work. The pop up "No such file or directory"
ill run you through the commands to create your private and public ssh keys
-ssh-keygen -t rsa -b 4096 -C "email@example.com" // to create your set of keys both public and private key and save it into a file
-vim ~/.ssh/config // to open up the file you created which contains the keys
-[ Host *
AddKeysToAgent yes
UserKeychain yes
IdentityFile ~/.ssh/id_rsa ] // paste this line of code in the [ ] in the file you create after executing the vim ~/.ssh/config command
- ls | grep gitkey // to display the keys created
- cat key_name // to display the content of any key created
- ssh-agent -s // to start the ssh-agent in the background
- vim ~/.ssh/config // to configure the created file which contains the keys
- ssh-add -K ~/.ssh/private_key_name // to add the private key to the ssh agent
The above commands should help you setup your ssh keys properly
@ayish1998 hope this was helpful
let me try this process
okay
@BertinAm Does this works on windows as well?
i haven't tried it on windows but you coud lookup how to install vim on command prompt and then follow it from there on and also how to run ssh commands too. For one final strategy try installing git bash and running the commands there.
Okay cool
Thanks
your welcome
So new to this space. Thanks for this.
Awesome, Thank you
Just watched this video and this is quite explanatory thanks
Thank You for the great info!
Thank you. This is very helpful.
Nice one
thanks bro
thanks good job
Thanks Gwen
thanks
Super helpful. Thanks
Thanks
thank you
Very helpful
are these commands different in windows
are these commands different in windows
No, they are the same.
Very helpful. Thank you
amazing thanks teacher
error: src refspec master does not match any
error: failed to push some refs to 'https://github.com/ShaYn541/demo-repo.git
I'm actually coming across this after several tries can anyone help ?
guys previously I was using my VS Code for the CS50P course but now I finished it and am trying to make my own SSH Key. I followed through the steps in the video. However I keep getting "Enter PIN for authenticator". What does that mean? I tried figuring out it myself, I was told to remove the CS50P SSH Key so I did. but I keep seeing the same thing. Can someone help me please.
i haven't tried it on windows but you coud lookup how to install vim on command prompt and then follow it from there on and also how to run ssh commands too. For one final strategy try installing git bash and running the commands there.
idk but it says bash: -vim: command not found
this is so much frustrating there is too much things that does not make sense to me im just copy pasting everything this is no good
thank you
This link was mentioned in https://www.youtube.com/watch?v=RGOj5yH7evk. I don't think it makes much sense if not directed from that link.