Press 'Space' to continue
Press 'n' to show/hide notes
Press 's' for speaker mode
git clone https://repository_url # https
...
git clone user@repository_url # ssh
git add path/to/file1 path/to/file2
...
git add .
git status
git commit
...
git commit -m "my commit message"
Identified by a sha1 (e.g.: 3241a3db7c76e29b63c0b1ea116b6db0f8619fdc)
git push origin your_branch_name
git pull origin your_branch_name
Push the file previously created on the develop branch
git checkout -b new_branch # deprecated
...
git switch -c new_branch
git checkout branch2 # deprecated
...
git switch branch2
git merge branch2 # will merge branch2 into the current branch
git log
...
git log --decorate --oneline --graph
git fetch
<<<<<<< HEAD:index.html
contact : email.support@github.com
======
please contact us at support@github.com
>>>>>>> iss53:index.html
You have to solve it manually, then commit the change
git tag -a 1.0.0 -m "my comment"
git reset --hard HEAD
git reset
...
git reset --mixed
git checkout myfile.txt # deprecated
...
git restore myfile.txt
We will see it the next section
git stash # Save changes into a temporary stack and remove them
git stash pop # restore changes from stash
Rewriting history must be done only on personal branches
git commit --amend
git rebase develop
Solve conflicts, then :
git add my-file-with-conflicts-resolved.txt
git rebase --continue
Merge is easier to use to deal with conflicts, since we treat all of them inside the same commit, contrary to rebase. Rebase will apply each commit, so you may need to solve conflicts for each commit.
Merge will create a merged commit. It makes some sense when you want to put your code into develop. It makes no sense when you want to update your personal branch from develop
On your personal branch, you may want to:
Identify the start commit from which you want to rewrite history
git log
# Identify the sha1 (excluded)
git rebase -i my_sha1
pick b6c57be commit message 1
pick 53c836a commit message 2
pick e2130ac commit message 3
# Rebase 4d32053..e2130ac onto 4d32053 (3 commands)
#
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
# f, fixup = like "squash" but keep only the previous
# commit's log message, unless -C is used, in which case
# keep only this commit's message; -c is same as -C but
# opens the editor
# If remote doen't have F and G
git push origin personal_branch
# Else, push force
git push -f origin personal_branch
Normalize your message commit (use a reference or create a new one for all developers)
Avoid manual merge. Use Pull Request for merging.
You must not be able to push directly into develop/main/master/release branch. Use a Pull request instead.
Use pull request to show your code and wait for reviewers or comments before merging.
Only work on your personal branches. Your personal branches must not be based on otherone personal branch.
Avoid parallel reference branches. You should only have at a time:
When you rewrite the history, force push as soon as possible to avoid an error telling you to pull the repository (which will lead to unexpected commits)
You can ignore some files by using a .gitignore file in root folder or sub folders
## Example
*.ipa
*.dSYM.zip
*.dSYM
You can generate .gitignore file using gitignore.io
oh-my-zsh (can be installed with homebrew)
To do list. Must be filled with the PO/BA, Tester and developer during the example mapping to move to "In Progress" status
Lifetime: from minutes to eternity
Developer create a branch (e.g.: feature/3 where 3 is the ID of the ticket). He develops the content of the ticket and create a pull request. Merging PR will change the status to "Done"
Code is merged. Tester can test it (on pair testing or on a staging environment if code has been deployed)
Code is tested. The ticket is waiting for deploying a released version
Released on production or pre-production
Github: benjdum59
Website: benjdum59.github.io
Mail: benjamin.dumont.pro@gmail.com
Go to Homepage