Git Workflow from the Beginning

      1 Comment on Git Workflow from the Beginning

Brilliant, is Git. GIT is a staging and deployment process and tool, for those working in a team simultaneously on the same project. While it is a bit daunting in the beginning, after you use it the process becomes second nature. I’m only starting, so it is appropriate for me to document my learning process, which might help others.

While git is used mostly for software development, where each team member can work on code simultaneously, it really facilitates team collaboration of any project. Two people can work on the same document, individually commit their work, and send it back to the server for someone else to approve and then merge.

Try Git: Git Tutorial has a cute tutorial to get you started. it is only 15 minutes long, longer if you take notes like I did, but was very helpful in explaining the commands. It does miss out some of the details of a complete workflow, but worthwhile to watch. Of course there is a lot more to git.

You will need to install the git tool on your specific computer with whatever operating system you choose. Research it.

Git directory Installation
git init: This sets up the git environment. Go to a directory you want git installed. You only do this once.
git config –global user.name “YOUR_USERNAME”: Add your name here, source
git config –global user.email “your_email_address@example.com”: Add email here

Commonly used Commands
git status: The most commonly used command. It will tell you the files that have changed but not added, added files, and recommend you do a commit
git branch: Shows you all your branches
git branch : create a new branch
git checkout : switch between branches

Git Document Workflow
Getting and Updating your Project
git clone: Initially you will need to do a git clone to get your project, but you only need to do this once, unless you delete your project.
git pull origin master: After your initial clone, use this to update your project from the server.

Overall Workflow

  1. git branch : You make a branch of your work. This is a copy. You make changes to the copy and not the master. This way the changes can be undone in an orderly manner.
  2. Edit your documents.
  3. git add /: Add these files to your staging area. You can add the whole directory, just ensure you have an ending “/”
  4. git commit -m “Some Comment”: Commit all changes to files in the staging area. The comment will remind you of the changes, which you will see when received by the server
  5. git push origin : Push your branch’s staging area up to the server
  6. On the server, do a merge request, followed by the approval for the merge

Other commands:
git reset

/: removes files from the staging area, opposite to the git add
git rm ‘*.txt’: removes files
git merge : You could merge files on your local, but it is best to do this on the server, just in case others have changes to the same content
git branch -d : delete a branch

git push origin : Git defaults to not pushing a new branch to the server, so you need this command. thanks, abresas

When git runs it sends you emails, so you know it has completed.

https://www.google.com/url?q=https%3A%2F%2Fwww.quora.com%2FIs-Github-used-with-coders-in-China-India-If-not-what-are-the-Github-equivalents&sa=D&sntz=1&usg=AFQjCNHv6tKqqCS7xPcDs7ky3ANBcBW3NA

1 thought on “Git Workflow from the Beginning

  1. David Ing

    Actually, it is not Git that sends you email when it is done, that is Gitlab CI running. Git by itself is a command line tool. Gitlab adds a web interface and Continuous Integration.

Leave a Reply

Your email address will not be published. Required fields are marked *