Git workflow and my new love of Git alias

For good or bad, my current Git workflow does not include merges, but rebasing.

It keeps the history cleaner, works with the established workflow (pretty standard GitHub flow) just no merge commits.  I was trying to find a nice graph of the master branch, but coming from a GitLab background it isn’t hard to find this information in the GitLab repo, but I don’t think GitHub really has this history feature. Anyone know the best way figuring out the history on GitHub?

We really enforce making sure to have meaningful commits, and commit messages. When you are working on your local branch, feel free to commit away, but an interactive rebase is needed before requesting your pull request. After you have done a couple of these rebases, there really isn’t anything to be afraid of. I hadn’t done one, and let me tell you, my first pull request was pretty painful. I think getting through the review process on that, and getting my commit history clean took just as long as coding my feature >_<. Now me, rebases, and amends are friends.  I haven’t had a chance to use fixup commits yet, but they are something on my raider to try out soon!

I enjoy using Git bash for my source repository needs.  Even with my more advanced workflow at my company, for me it has the most flexibility.  I have given Sourcetree (works better with BitBucket then GitHub) and Git Kracken a try before, and it is nice to have visuals when you need to deal with complex conflict situations, but I keep on going back to my trusty Git Bash.  I never used to be a command line person, just in certain situations, but now especially since I have switched over to Ruby and Rails I have at least 3-4 terminals open at anyone time. I even exited Vim yesterday without having to look it up! I feel that should be some sort of milestone.

 

 

 

 

 

 

Also I have been making use of GIT CLI alias, also installed multiple scripts to run in the terminal (terminal parrot I’m looking at you!).  Some of these help me with my job more then others :). If you don’t have a git alias, get yourself one stat. You just need to add lines to ~/.gitconfig

[alias]
    st = status
    ci = commit -v

Some of my personal favorites right now are:

st = status
co = checkout
dm = diff –patience master
prb = pull –rebase
pu = pull –rebase origin master
pf = push –force-with-lease
po = push origin master

What’s in your Git alias? And also how awesome is Command+Option+Shift+V on MacOS? That was the key to my problem with copy and pasting text and not keeping the old formatting!

Finding out how little you know about Git

I haven’t been a Git user for a long time, I have just been actively using it since January. That may not sound like a long time, but for a developer using a tool for over 5 months is almost as much as some projects take (if you are lucky) or as long as a contract is.  Since switching from Java to Ruby, and moving to a new company who knows much more about this, I have learned how unsophisticated we were using Git.

We were on GitLab, using it with bash in a modified GitHub flow with a master and develop branches, all features were branched off of the develop.  We did have merge commit messages, and had some CI/CD integration pulling in from a internet accessible GitLab to an internal GitLab.  The switch from Subversion was done fairly easily, with some reorganization needed to switch up some of the repo structure (we went for a one-to-one relationship with all project == new git repo, but that made waaaaaay too many repos).  So, I had been doing some Git, and now I have learned that I really don’t know how to do Git.

Did I know what a Git alias was? Nope. What about rebase, pushing with options, or forking a repo? Nope, nope and nope.

So I now I have a git alias (that I have to have pulled up in a notepad so I can remember all the commands) and have to be a lot more specific with my commit messages (they are a-ok for development but when you are ready for you pull request, squash those babies) and no more straight pull and pushing for me! I need to remember to rebase, rebase, rebase and for the love of all that is good don’t add in extraneous commit messages, make sure to amend. With all this changing of history I am doing, I am feeling like a time-traveler.