Louis Jones

Louis Jones

1631083712

13 Git Tips and Tricks to Improve Your Workflow

Productive programmers tend to be really good at Git. Take a look at 13 advanced git tips and tricks to supercharge your development workflow. 

📚 Chapters

00:00 Git Started
00:59 Combine add & commit
01:20 Aliases
01:38 Amend
02:03 Force Push
02:24 Revert
02:47 Codespaces
03:21 Stash
04:05 PC Master Branch
04:27 Pretty Logs
04:51 Bisect
05:14 Autosquash
06:18 Hooks
06:58 Destroy Things
07:41 Checkout to Last

#git #programming #developer 

What is GEEK

Buddha Community

13 Git Tips and Tricks to Improve Your Workflow
Ray  Patel

Ray Patel

1619518440

top 30 Python Tips and Tricks for Beginners

Welcome to my Blog , In this article, you are going to learn the top 10 python tips and tricks.

1) swap two numbers.

2) Reversing a string in Python.

3) Create a single string from all the elements in list.

4) Chaining Of Comparison Operators.

5) Print The File Path Of Imported Modules.

6) Return Multiple Values From Functions.

7) Find The Most Frequent Value In A List.

8) Check The Memory Usage Of An Object.

#python #python hacks tricks #python learning tips #python programming tricks #python tips #python tips and tricks #python tips and tricks advanced #python tips and tricks for beginners #python tips tricks and techniques #python tutorial #tips and tricks in python #tips to learn python #top 30 python tips and tricks for beginners

Madyson  Reilly

Madyson Reilly

1604109000

Best Practices for Using Git

Git has become ubiquitous as the preferred version control system (VCS) used by developers. Using Git adds immense value especially for engineering teams where several developers work together since it becomes critical to have a system of integrating everyone’s code reliably.

But with every powerful tool, especially one that involves collaboration with others, it is better to establish conventions to follow lest we shoot ourselves in the foot.

At DeepSource, we’ve put together some guiding principles for our own team that make working with a VCS like Git easier. Here are 5 simple rules you can follow:

1. Make Clean, Single-Purpose Commits

Oftentimes programmers working on something get sidetracked into doing too many things when working on one particular thing — like when you are trying to fix one particular bug and you spot another one, and you can’t resist the urge to fix that as well. And another one. Soon, it snowballs and you end up with so many changes all going together in one commit.

This is problematic, and it is better to keep commits as small and focused as possible for many reasons, including:

  • It makes it easier for other people in the team to look at your change, making code reviews more efficient.
  • If the commit has to be rolled back completely, it’s far easier to do so.
  • It’s straightforward to track these changes with your ticketing system.

Additionally, it helps you mentally parse changes you’ve made using git log.

#open source #git #git basics #git tools #git best practices #git tutorials #git commit

Git Merge: A Git Workflow explained 

What is Git Merge?

Merge is a command used in Git to move the changes in branch to another. Usually, the new features are developed in the dev branch and merged into the master branch after finishing the development. All the changes in the dev branch is added to the master branch on the merge. but the dev branch will be unaffected.

— merge pic —

How to do a Git Merge

Let’s do a Git Merge step by step to understand how it works. Except the merging part, many steps from cloning the repo to publishing the changes will be the same as in Git Rebase Tutorial because we are trying to do the same thing in a different way.

Step 1: Fork and clone the desired repo

Let’s reuse our rebase-demo repository for this. Go to https://github.com/kdanW/rebase-workflow-demo and click the button ‘Fork’ in the top right-hand corner. Now go to your forked repo, click ‘Clone or Download’ button and copy the link shown.

Image for post

Now go to a directory of your preference and type the following command on the terminal to download the repo into your local PC.

git clone https://github.com/<YOUR_USERNAME>/rebase-workflow-demo

#git-merge #git-workflow #github #merge #git

7 Best Practices in GIT for Your Code Quality

There is no doubt that Git plays a significant role in software development. It allows developers to work on the same code base at the same time. Still, developers struggle for code quality. Why? They fail to follow git best practices. In this post, I will explain seven core best practices of Git and a Bonus Section.

1. Atomic Commit

Committing something to Git means that you have changed your code and want to save these changes as a new trusted version.

Version control systems will not limit you in how you commit your code.

  • You can commit 1000 changes in one single commit.
  • Commit all the dll and other dependencies
  • Or you can check in broken code to your repository.

But is it good? Not quite.

Because you are compromising code quality, and it will take more time to review codeSo overall, team productivity will be reduced. The best practice is to make an atomic commit.

When you do an atomic commit, you’re committing only one change. It might be across multiple files, but it’s one single change.

2. Clarity About What You Can (& Can’t) Commit

Many developers make some changes, then commit, then push. And I have seen many repositories with unwanted files like dll, pdf, etc.

You can ask two questions to yourself, before check-in your code into the repository

  1. Are you suppose to check-in all these files?
  2. Are they part of your source code?

You can simply use the .gitignore file to avoid unwanted files in the repository. If you are working on more then one repo, it’s easy to use a global .gitignore file (without adding or pushing). And .gitignore file adds clarity and helps you to keep your code clean. What you can commit, and it will automatically ignore the unwanted files like autogenerated files like .dll and .class, etc.

#git basics #git command #git ignore #git best practices #git tutorial for beginners #git tutorials

Use “git add” smarter with “--patch”

When I first learned how to use git, I was presented with a list of steps to follow. First, use git add -A to add everything that is changed into the commit. Second, create a commit with a message using git commit -m “This is my message”. Lastly, git push to push my commit to the code repository. Pretty simple, right?
Now, if you have done quite a bit of coding in an established codebase, whether open source or in a company, you know that git add -A is not a command that you use very often, if not at all. For the most part, people tend to add files to a commit one at a time, using either a GUI or via the command line with git add <file_name>. I am guilty of using the latter approach. I was introduced to git via the command line, like many developers, and never really wanted to learn a GUI tool that probably calls the command line under the hood anyway.

#git-interactive-mode #git #how-to-use-github #developer-workflow #git-workflow