Skip to content

Instantly share code, notes, and snippets.

@markodayan
Last active September 1, 2020 13:07
Show Gist options
  • Save markodayan/56cecf21c6591822916b0613fb1dab07 to your computer and use it in GitHub Desktop.
Save markodayan/56cecf21c6591822916b0613fb1dab07 to your computer and use it in GitHub Desktop.
Git Version Control
# list all commits made across different branches on the repo
git log
# list all branches (will also show which branch you are currently on)
git branch
# switch to a branch
git checkout <existing_branch_name>
# create new branch
git checkout -b <new_branch_name>
# now if i do git add . and git commit -> this will add the commit to the new branch specified on checkout
# if I want to push this new branch to say my remote on Github (origin), I can do this:
git push -u origin <new_branch_name>
# to change to a branch
git checkout <existing_branch_name>
# to pull changes (made from someone else from a branch) [This will be important in collaboration]
git pull origin <branch_name>
# adding new ignore folders to folders already pushed to repo (by clearing cache)[here I want to ignore 'config' folder]
git rm -r --cached config/
@markodayan
Copy link
Author

If I want to make hanges and contribute to an Open Source Project I need to make a pull request.

We need to fork a repo. This will make my own copy of the repo where I have permission to do what I want with that version. Then I can make changes and push them to my forked version of the project. Then you can make a pull request to the Open Source Project devs on Github then they can reject or accept it and merge it in

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment