git config
Use global configuration with --global
flag.
$ git config --global https.sslBackend openssl
$ git config --global https.sslVerify false
$ git config --global http.proxy http://<user>:<password>@<domain>:<port>
$ git config --global https.proxy https://<user>:<password>@<domain>:<port>
In root path of project, run:
$ git init
$ git add .
$ git config user.email <email to login in git repository>
$ git commit -m "a message"
$ git remote add <origin> https://<user>:<password>@domain/<user-owner>/<repositoryname>.git
or to SSH authentication
$ git remote add <origin> git@domain-<ssh-filename>:<username>/<repositoryname>.git
$ git push -u origin master
$ git rm -r <path>
$ git rm <path>
$ git branch <branch>
To create a new branch with only the last commit...
$ git checkout --orphan <branch>
So make git add
; git commit
...
$ git checkout <branch>
$ git checkout -b <branch>
$ git checkout -b <branch> <version>
$ git branch
$ git branch --set-upstream-to=origin/<branch>
$ git push origin <branch>
$ git pull --rebase [origin]
In conflict case solve it, after that run:
$ git rebase --skip
If something goes wrong, come back running:
$ git rebase --abort
If you want to merge, just run:
$ git pull
$ git push --delete origin <branch>
$ git branch -d <branch>
Branches are importants to organization of the project. When creating a new feature, fixing a bug, or make a refactoring we should do that in a new branch following the below steps:
- Create a new branch;
- checkout to this new branch;
- develop, fix or refactor the code;
- when you finish, run:
$ git rebase <the more stable (usually) branch>
- return to more stable branch and run;
$ git merge <the branch of new feature, repair or refactoring>
- and finally, run:
$ git push
$ git diff [file]
$ git tag <value>
$ git push origin <tag>
Obs.: tag’s content can’t be changed.
$ git tag -d <tag>
$ git push --delete origin <tag>
$ git reset --hard HEAD~1
$ git revert <"HEAD" or commit hash>
$ git push
- Clone the project;
- create a new origin;
- create and checkout to a new branch;
When you finish:
- Commit the changes;
- checkout to main branch;
- make "rebase" from branch you worked for;
- push.
Ready. Now just do "Pull Request" through main branch.
$ git fetch <origin>
$ git rebase <origin>/<branch>
Sources: