Before you reach the point of filing for bankruptcy you must seek credit counseling. If the credit counseling service creates a debt repayment program for you this action will most likely not be noted on your credit report. If it is reported it will still not look as serious as filing for bankruptcy. Once bankruptcy is on your report it will be more difficult and expensive to obtain credit.
Rehabilitating your credit is a slow process. You should start by making small purchases with your checking or savings account that you know you can repay. Eventually you can move onto borrowing money from a lender or a creditor.