Skip to content

Git Panic #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
camilavargasp opened this issue Jul 22, 2022 · 4 comments
Open

Git Panic #7

camilavargasp opened this issue Jul 22, 2022 · 4 comments

Comments

@camilavargasp
Copy link
Contributor

camilavargasp commented Jul 22, 2022

git commands

Command Description
git status Lists which branch you are working from and lists which files are staged, unstaged, and untracked.
git branch List of all local branches
git branch -r List of all remote branches
git branch -a List of all branches (local and remote)
git checkout name_of_branch Swiches/ check out banch named name_of_branch branch
git checkout -b new_branch Create and check out a new branch named new_branch
git push -u origin pushes the new local branch and and all commits within that branch
git add . stage all files
git commit -m write_a_message_here commit all staged files with commit message.
reset --hard origin/main remove all the commits ahead of the remote main branch
git push -u origin branch-name pushing a new branch with all the commits in the branch
git log --graph --all graphic representation of what is going on with your branches and commits
git push --delete origin branch_name delete a branch locally and remote
@camilavargasp
Copy link
Contributor Author

Exercise:

  • Using the commands above, create a new branch from the command line and push it to remote.
  • Name the new branch lastname_test
  • First, clone the repo or pull to make sure you have the most up-to-date version.

@brunj7
Copy link

brunj7 commented Jul 23, 2022

FYI could be of interest, especially the references: https://github.com/nceas-coding-club/hacky-hour-materials/blob/master/2018-05-08_git-advanced.md

@camilavargasp
Copy link
Contributor Author

Git Workflow

Start with:
git fetch
git rebase
OR
git pull
Then, after you have done your changes:
git add .
git commit -m "message"
git fetch
git rebase
git push

@camilavargasp
Copy link
Contributor Author

git cherry-pick allows you to select a specific commit and bring it into the checkout branch. See explanation and examples here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants