-
Notifications
You must be signed in to change notification settings - Fork 1
Git cheatsheet
0 - Make sure you are up to date with the latest main branch and create a new branch
git fetch --prune # Fetch all changes and remove deleted branch from local folder
git checkout main # Switch to main branch
git pull # Pull the latest changes (I think it's not needed if fetch was called but unsure)
git checkout -b new_branch_name # Switch to a new branch
1 - Tag the files to be tracked (i.e. the file you modified) and commit
git add filename # You can list as many files as you want, or you can add them one by one
git commit -m "A message to summarize what you did in 1-2 lines"
2 - Push the changes to the remote server
git push
if this is a new branch, git will suggest the right command which is
git push --set-upstream origin new_branch_name
Steps 1 and 2 can be repeated as many time as you need to make changes.
3 - Create your PR on GitHub.
Go to https://github.com/adehecq/argentiere_pleiades_smb/pulls. A message should show up to suggest to create a new pull request. Click on the "create pull request" button. You can add a title and description of the changes. You can edit these as many times as you want to describe your progress
4 - Merge the PR
Once you're done implementing all your changes, click the "merge pull request" button. Then you can delete your local and remote branch, either on GitHub, or in command line
git checkout main # switch to main branch
git branch -d new_branch_name # delete local branch
git push origin --delete new_branch_name # delete remote branch
You can check that branches has been delete by displaying the list of all branches (local and remote) with git branch -a
.