The Git community book (french) (english)
Some other git tips
There is no git info (like svn info) command available with git :( Instead you can use following commands.
Remote branches:
Local branches:
If you want to also remove directories, run
If you just want to remove ignored files, run
If you want to remove ignored as well as non-ignored files, run
MyA is a fork of the repository A. You use MyA for your devs and made updates. In the same time, the origin repository A still follows its way (new push, etc.). How to do if you want to (re)synchronize your forked repository with its origin?
If you are many people working on the same software, your central git repository will end with a lot of branches and merge. Indeed, developers start to work on a revision and, when they are ready to push their changes, there will probably be new revisions from other developers. The default behavior of git when pulling changes from the central repository is to define a branch, add your commits to this branch and then merge the branch back to the master. To avoid that, especially if you know there is no conflict, you can use git rebase as explained here or here (french).
Hopefully, there is a shorcut for that. You can use pull with git pull --rebase. Git can be configured to make it the default behavior:
You can also check this useful post
Note: It is better to don't use an already existing tag name to name your branch.
It will create an annotated tag (recommended)
To list tags:
To remove a remote branch or tag
To remove a local tag
If the branch has no upstream:
The best option is to provide the -u option when pushing to the remote to specify the upstream automatically.
To easily track a remote branch from someone else
It creates and checks out "feature" branch that tracks "origin/feature".
It is as simple as
It will create a new commit. The reverted commit is still present in the history.
The git rebase command allows you to easily change a series of commits, modifying the history of your repository. You can reorder, edit, or squash commits together.
Warning: Because changing your commit history can make things difficult for everyone else using the repository, it's considered bad practice to rebase commits when you've already pushed to a repository.
Rebase all the commits between another branch and the current branch state
Rebasing commits against a point in time
To rebase the last few commits in your current branch, you can enter the following command in your shell:
Remove the last commit from Git history
If the commit has already been pushed to the remote, and you want to propagate the change (WARNING: this is bad if someone already has the commit that will be deleted into his history):