mandag 23. september 2013

Bare minimum Git workflow

While pondering my understanding of Git yesterday, I though: What is the bare minimum you have to understand in order to use Git. And this is my conclusion:

git init sets the working directory. You can't get anywhere unless you either do this or start from someone else’s repo.

git add --all to have all files set to the stage to be committed. In the start, there's no need to exclude files. What you are looking for are probably to create snapshots of points in time where your files worked.

git commit -m "This is new" to create a snapshot of the staged files.

git checkout -- filename will get the file as it was at the last commit more on stack overflow.

In essence: You need to start managing versions (init), add a version of the files (add) so they can be commit as a snapshot (commit) and then be able to restore a file to the state at the last commit. Drop any one of these, and it either wont work or there's no point in doing version control.

In addition, the commands get status and get help commandname is essential in order to use the commands above and to expand your knowledge of them.

Next stage is to expand with branching and merging in order to add so structure and order to the workflow.

Etiketter: , ,

0 Kommentarer:

Legg inn en kommentar

Abonner på Legg inn kommentarer [Atom]

<< Startsiden